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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Environment:
      Ubuntu 14.04 x86_64
    • Similar Issues:

      Description

      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 ]

        Attachments

          Activity

          rovanion Rovanion Luckey created issue -
          danielbeck Daniel Beck made changes -
          Field Original Value New Value
          Component/s core [ 15593 ]
          Component/s _test [ 19622 ]
          Hide
          danielbeck 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.

          Show
          danielbeck 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.
          danielbeck Daniel Beck made changes -
          Assignee Daniel Beck [ danielbeck ]
          Hide
          rovanion Rovanion Luckey added a comment -

          This change makes the init script report [fail].

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

          Show
          rovanion Rovanion Luckey added a comment - This change makes the init script report [fail] . Going on, is the port hard coded in the init script?
          Hide
          markewaite Mark Waite added a comment - - edited

          Rovanion Luckey 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.

          Show
          markewaite Mark Waite added a comment - - edited Rovanion Luckey 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.
          Hide
          scm_issue_link 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.

          Show
          scm_issue_link 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.
          scm_issue_link SCM/JIRA link daemon made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Hide
          danielbeck 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.

          Show
          danielbeck 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.
          Hide
          rovanion 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.

          Show
          rovanion 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.
          Hide
          danielbeck 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.)

          Show
          danielbeck 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.)
          Hide
          rovanion Rovanion Luckey added a comment -

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

          Show
          rovanion Rovanion Luckey added a comment - Ah, well then's everything fine and dandy! Have a great friday!
          Hide
          dogfood 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
          Show
          dogfood 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
          Hide
          scm_issue_link 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

          Show
          scm_issue_link 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
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 158862 ] JNJira + In-Review [ 195911 ]

            People

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

              Dates

              Created:
              Updated:
              Resolved: