Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-24966

Debian init script says: [OK] when failing on port check.

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • None
    • Ubuntu 14.04 x86_64

      After installing Jenkins from the repositories given on the site, I attempted to start the service by running:

      $ sudo service jenkins start

      The problem is that even though it spits out the error message:

      The selected http port (8080) seems to be in use by another program
      Please select another port to use for jenkins

      It ends by telling the user that everything went just as expected:

      • Starting Jenkins Continuous Integration Server jenkins [ OK ]

          [JENKINS-24966] Debian init script says: [OK] when failing on port check.

          Daniel Beck added a comment -

          Could you try changing the line in the Jenkins init script that says

          check_tcp_port "http" "$HTTP_PORT" "8080" || return 1

          to return 2 instead? I have no Debian system to try this with, and I don't want to commit something untested.

          Daniel Beck added a comment - Could you try changing the line in the Jenkins init script that says check_tcp_port "http" "$HTTP_PORT" "8080" || return 1 to return 2 instead? I have no Debian system to try this with, and I don't want to commit something untested.

          This change makes the init script report [fail].

          Going on, is the port hard coded in the init script?

          Rovanion Luckey added a comment - This change makes the init script report [fail] . Going on, is the port hard coded in the init script?

          Mark Waite added a comment - - edited

          rovanion I think you may have found another bug in the init script with that observation.

          /etc/default/jenkins includes a line (on Debian):

          HTTP_PORT=8080

          It seems like the init script check_tcp_port call might need to use that variable. Unfortunately, I'm not sure when the /etc/default/jenkins file is sourced into the init script, so it may not yet be available when that call is made.

          Mark Waite added a comment - - edited rovanion I think you may have found another bug in the init script with that observation. /etc/default/jenkins includes a line (on Debian): HTTP_PORT=8080 It seems like the init script check_tcp_port call might need to use that variable. Unfortunately, I'm not sure when the /etc/default/jenkins file is sourced into the init script, so it may not yet be available when that call is made.

          Code changed in jenkins
          User: Daniel Beck
          Path:
          debian/debian/jenkins.init
          http://jenkins-ci.org/commit/jenkins/2b6c00db3406c753291ff00ccd16d64ad5f92a78
          Log:
          [FIXED JENKINS-24966] Return failure when port is in use

          Both 0 and 1 are used to indicate some kind of success (the latter when Jenkins doesn't need to be started because it was already running), so we need to return 2.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: debian/debian/jenkins.init http://jenkins-ci.org/commit/jenkins/2b6c00db3406c753291ff00ccd16d64ad5f92a78 Log: [FIXED JENKINS-24966] Return failure when port is in use Both 0 and 1 are used to indicate some kind of success (the latter when Jenkins doesn't need to be started because it was already running), so we need to return 2.

          Daniel Beck added a comment -

          Alright, committed the fix towards 1.584 or 1.585 (not sure which due to mid-week 1.583 release).

          The port is not hard coded, as you can by from the use of $HTTP_PORT variable. See /etc/defaults/jenkins.

          Daniel Beck added a comment - Alright, committed the fix towards 1.584 or 1.585 (not sure which due to mid-week 1.583 release). The port is not hard coded, as you can by from the use of $HTTP_PORT variable. See /etc/defaults/jenkins.

          The config is sourced as the fifth active line in the init script. Though I'm wondering about the line in function do_start() which reads:

          check_tcp_port "http" "$HTTP_PORT" "8080" || return 2

          I'm wondering why 8080 is there as well as $HTTP_PORT.

          Rovanion Luckey added a comment - The config is sourced as the fifth active line in the init script. Though I'm wondering about the line in function do_start() which reads: check_tcp_port "http" "$HTTP_PORT" "8080" || return 2 I'm wondering why 8080 is there as well as $HTTP_PORT.

          Daniel Beck added a comment -

          8080 is the default used when HTTP_PORT is empty, so it's passed as an alternative port to check. The function is defined in the same file.

          (Of course one possible issue would be behavior with HTTP_PORT=-1, but that's an unrelated different issue.)

          Daniel Beck added a comment - 8080 is the default used when HTTP_PORT is empty, so it's passed as an alternative port to check. The function is defined in the same file. (Of course one possible issue would be behavior with HTTP_PORT=-1, but that's an unrelated different issue.)

          Ah, well then's everything fine and dandy! Have a great friday!

          Rovanion Luckey added a comment - Ah, well then's everything fine and dandy! Have a great friday!

          dogfood added a comment -

          Integrated in jenkins_main_trunk #3718
          [FIXED JENKINS-24966] Return failure when port is in use (Revision 2b6c00db3406c753291ff00ccd16d64ad5f92a78)

          Result = SUCCESS
          daniel-beck : 2b6c00db3406c753291ff00ccd16d64ad5f92a78
          Files :

          • debian/debian/jenkins.init

          dogfood added a comment - Integrated in jenkins_main_trunk #3718 [FIXED JENKINS-24966] Return failure when port is in use (Revision 2b6c00db3406c753291ff00ccd16d64ad5f92a78) Result = SUCCESS daniel-beck : 2b6c00db3406c753291ff00ccd16d64ad5f92a78 Files : debian/debian/jenkins.init

          Code changed in jenkins
          User: Daniel Beck
          Path:
          debian/jenkins.init
          http://jenkins-ci.org/commit/packaging/e28110f5e5c423f9a826fe1f5a07fdae52f1348f
          Log:
          [FIXED JENKINS-24966] Return failure when port is in use

          Both 0 and 1 are used to indicate some kind of success (the latter when Jenkins doesn't need to be started because it was already running), so we need to return 2.
          Originally-From: jenkins-ci.org/commit/core/2b6c00db3406c753291ff00ccd16d64ad5f92a78

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: debian/jenkins.init http://jenkins-ci.org/commit/packaging/e28110f5e5c423f9a826fe1f5a07fdae52f1348f Log: [FIXED JENKINS-24966] Return failure when port is in use Both 0 and 1 are used to indicate some kind of success (the latter when Jenkins doesn't need to be started because it was already running), so we need to return 2. Originally-From: jenkins-ci.org/commit/core/2b6c00db3406c753291ff00ccd16d64ad5f92a78

            danielbeck Daniel Beck
            rovanion Rovanion Luckey
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: