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

1.336 opensuse init script broken (patch attached)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Environment:
      opensuse-11.2
    • Similar Issues:

      Description

      "/etc/init.d/hudson start" fails to write Hudsons PID to /var/run/hudson.pid. As result "/etc/init.d/hudson stop" wont work.
      When starting Hudson the script compares its own Session PID (variable $MY_SESSION_ID) to that of all processes running under user hudson with matching command line (variable $sess). However the value in $MY_SESSION_ID begins with a leading blank, while $sess contains numbers only - the comparison fails.

      Also "/etc/init.d/hudson restart" will not start a new process if the "start" command is run too soon after "stop". I've added a five seconds break between the commands.

      Please see attached patch.

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          SOURCES/jenkins.init.in
          http://jenkins-ci.org/commit/packaging/b5b5677d9c47e77c84046b363175305b52ffab48
          Log:
          [FIXED JENKINS-5020] OpenSUSE init script fix.

          Originally-From: jenkins-ci.org/commit/core/0c1966657f3e5b932bec88e59274aed448bddce7

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: SOURCES/jenkins.init.in http://jenkins-ci.org/commit/packaging/b5b5677d9c47e77c84046b363175305b52ffab48 Log: [FIXED JENKINS-5020] OpenSUSE init script fix. Originally-From: jenkins-ci.org/commit/core/0c1966657f3e5b932bec88e59274aed448bddce7
          Hide
          oreinert Olav Reinert added a comment -

          Yes, the "semi-undocumented behaviour of startproc" came back to bite me - the patch is not entirely reliable. The problem is that the -v option causes the PID of some Java process on the system to be printed, not necessarily the just started one.

          Show
          oreinert Olav Reinert added a comment - Yes, the "semi-undocumented behaviour of startproc" came back to bite me - the patch is not entirely reliable. The problem is that the -v option causes the PID of some Java process on the system to be printed, not necessarily the just started one.
          Hide
          oreinert Olav Reinert added a comment - - edited

          A new patch is being worked on...

          Show
          oreinert Olav Reinert added a comment - - edited A new patch is being worked on...
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          changelog.html
          opensuse/SOURCES/jenkins.init.in
          http://jenkins-ci.org/commit/core/0c1966657f3e5b932bec88e59274aed448bddce7
          Log:
          [FIXED JENKINS-5020] OpenSUSE init script fix.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: changelog.html opensuse/SOURCES/jenkins.init.in http://jenkins-ci.org/commit/core/0c1966657f3e5b932bec88e59274aed448bddce7 Log: [FIXED JENKINS-5020] OpenSUSE init script fix.
          Hide
          oreinert Olav Reinert added a comment - - edited

          I've submitted a new patch for fixing the openSUSE init script which replaces the previous one. This patch has the following advantages:

          a) The PID of the Jenkins process gets written into the pid file (finally!).
          b) The Jenkins process is started in a new session, thus properly releasing it from its parent.
          c) A lot of cruft, which tried to work around the peculiar PID-handling (mis-)behaviour of startproc, is removed.
          d) The stop action reverts to using killproc, which waits for the stopped process to die.
          e) Due to d), the restart action does not need an extra pause, as suggested by the old patch.

          The patch has been tested on openSUSE 11.1 and 11.3, and works fine.
          However, it relies on semi-undocumented behaviour of startproc. Quoting from the man page:

          The option -v makes startproc print out verbose diagnostics.

          What actually gets printed is just the PID of the process that was started, and the patch makes use of this fact to fix the problem of the empty PID file. Meaning, this fix might not work forever, but on current versions of openSUSE (11.x) it's fine.

          Show
          oreinert Olav Reinert added a comment - - edited I've submitted a new patch for fixing the openSUSE init script which replaces the previous one. This patch has the following advantages: a) The PID of the Jenkins process gets written into the pid file (finally!). b) The Jenkins process is started in a new session, thus properly releasing it from its parent. c) A lot of cruft, which tried to work around the peculiar PID-handling (mis-)behaviour of startproc , is removed. d) The stop action reverts to using killproc, which waits for the stopped process to die. e) Due to d), the restart action does not need an extra pause, as suggested by the old patch. The patch has been tested on openSUSE 11.1 and 11.3, and works fine. However, it relies on semi-undocumented behaviour of startproc . Quoting from the man page: The option -v makes startproc print out verbose diagnostics. What actually gets printed is just the PID of the process that was started, and the patch makes use of this fact to fix the problem of the empty PID file. Meaning, this fix might not work forever, but on current versions of openSUSE (11.x) it's fine.
          Hide
          tex_newline tex_newline added a comment -

          First part of the bug has vanished, ps doesn't generate that leading blank anymore.

          But the restart issue is still valid.

          Show
          tex_newline tex_newline added a comment - First part of the bug has vanished, ps doesn't generate that leading blank anymore. But the restart issue is still valid.

            People

            Assignee:
            oreinert Olav Reinert
            Reporter:
            tex_newline tex_newline
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: