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

Jenkins on Linux can not restart after plugin update

      Jenkins can not restart after plugin update if jenkins' java is started with 'java' and without full path.

      It doesn't rexec itself with the following logs:
      Warnung: Failed to restart Jenkins
      java.io.IOException: Failed to exec 'java' Datei oder Verzeichnis nicht gefunden
      at hudson.lifecycle.UnixLifecycle.restart(UnixLifecycle.java:84)
      at jenkins.model.Jenkins$24.run(Jenkins.java:3337)

      It seems to be caused by this recent change:
      https://github.com/jenkinsci/jenkins/commit/547d4ed8d35de6be4b2788e4816019bb8cc94902#diff-1df54b5ad5f99455e21579688db5be50

      From a quick look I guess this could be fixed by using execvp instead of execv as below:

      • LIBC.execv(exe, new StringArray(args.toArray(new String[args.size()])));
        + LIBC.execvp(exe, new StringArray(args.toArray(new String[args.size()])));

      I understand that for those calling java as /usr/bin/java the execv approach should work, but without the full path it should still work IMHO.

      Thanks,
      Simon

          [JENKINS-22818] Jenkins on Linux can not restart after plugin update

          Simon Matter added a comment -

          The change as described above does indeed break things which have been working fine before.

          The jenkins docs show how it should be possible to start it:
          https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins

          That way you can start it but it won't restart after updating plugins - it hangs instead.

          Simon Matter added a comment - The change as described above does indeed break things which have been working fine before. The jenkins docs show how it should be possible to start it: https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins That way you can start it but it won't restart after updating plugins - it hangs instead.

          Simon Matter added a comment -

          Doesn't this patch fix it?

          Simon Matter added a comment - Doesn't this patch fix it?

          I just proposed a pull request with your patch here: https://github.com/jenkinsci/jenkins/pull/1239

          The man page of execvp explains that searching on the path for the executable is only done when the specified filename does not contain a slash character, so it should effectively be ok now.

          Yoann Dubreuil (Inactive) added a comment - I just proposed a pull request with your patch here: https://github.com/jenkinsci/jenkins/pull/1239 The man page of execvp explains that searching on the path for the executable is only done when the specified filename does not contain a slash character, so it should effectively be ok now.

          Simon Matter added a comment -

          Thanks for the fix!

          Simon Matter added a comment - Thanks for the fix!

          Simon Matter added a comment -

          How can we make this patch go into upstream?

          Simon Matter added a comment - How can we make this patch go into upstream?

          Oleg Nenashev added a comment -

          Increased the bug's priority.
          The issue has been introduced in 1.561, hence the LTS backporting is not required

          Oleg Nenashev added a comment - Increased the bug's priority. The issue has been introduced in 1.561, hence the LTS backporting is not required

          Code changed in jenkins
          User: Yoann Dubreuil
          Path:
          core/src/main/java/hudson/lifecycle/UnixLifecycle.java
          core/src/main/java/hudson/util/jna/GNUCLibrary.java
          http://jenkins-ci.org/commit/jenkins/3ddd2b0c0876239316b5cfc6bca497821bd200b8
          Log:
          [FIX JENKINS-22818] fix jenkins restart on Linux after plugin update if the java executable running Jenkins is started without its full path

          The patch uses 'execvp' instead of 'execv' to lookup the java executable filename in the PATH if the specified filename does not contain a slash character.
          Regression introduced in 547d4ed8d35de6be4b2788e4816019bb8cc94902

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Yoann Dubreuil Path: core/src/main/java/hudson/lifecycle/UnixLifecycle.java core/src/main/java/hudson/util/jna/GNUCLibrary.java http://jenkins-ci.org/commit/jenkins/3ddd2b0c0876239316b5cfc6bca497821bd200b8 Log: [FIX JENKINS-22818] fix jenkins restart on Linux after plugin update if the java executable running Jenkins is started without its full path The patch uses 'execvp' instead of 'execv' to lookup the java executable filename in the PATH if the specified filename does not contain a slash character. Regression introduced in 547d4ed8d35de6be4b2788e4816019bb8cc94902

          vjuranek added a comment -

          Should be fixed by proposed patch (PR #1239)

          vjuranek added a comment - Should be fixed by proposed patch (PR #1239)

          dogfood added a comment -

          Integrated in jenkins_main_trunk #3413
          [FIX JENKINS-22818] fix jenkins restart on Linux after plugin update if the java executable running Jenkins is started without its full path (Revision 3ddd2b0c0876239316b5cfc6bca497821bd200b8)

          Result = SUCCESS
          Vojtech Juranek : 3ddd2b0c0876239316b5cfc6bca497821bd200b8
          Files :

          • core/src/main/java/hudson/lifecycle/UnixLifecycle.java
          • core/src/main/java/hudson/util/jna/GNUCLibrary.java

          dogfood added a comment - Integrated in jenkins_main_trunk #3413 [FIX JENKINS-22818] fix jenkins restart on Linux after plugin update if the java executable running Jenkins is started without its full path (Revision 3ddd2b0c0876239316b5cfc6bca497821bd200b8) Result = SUCCESS Vojtech Juranek : 3ddd2b0c0876239316b5cfc6bca497821bd200b8 Files : core/src/main/java/hudson/lifecycle/UnixLifecycle.java core/src/main/java/hudson/util/jna/GNUCLibrary.java

          Code changed in jenkins
          User: Yoann Dubreuil
          Path:
          core/src/main/java/hudson/lifecycle/UnixLifecycle.java
          core/src/main/java/hudson/util/jna/GNUCLibrary.java
          http://jenkins-ci.org/commit/jenkins/c3ddea2a71d61eeed39012155a15297b0059874a
          Log:
          [FIX JENKINS-22818] fix jenkins restart on Linux after plugin update if the java executable running Jenkins is started without its full path

          The patch uses 'execvp' instead of 'execv' to lookup the java executable filename in the PATH if the specified filename does not contain a slash character.
          Regression introduced in 547d4ed8d35de6be4b2788e4816019bb8cc94902

          (cherry picked from commit 3ddd2b0c0876239316b5cfc6bca497821bd200b8)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Yoann Dubreuil Path: core/src/main/java/hudson/lifecycle/UnixLifecycle.java core/src/main/java/hudson/util/jna/GNUCLibrary.java http://jenkins-ci.org/commit/jenkins/c3ddea2a71d61eeed39012155a15297b0059874a Log: [FIX JENKINS-22818] fix jenkins restart on Linux after plugin update if the java executable running Jenkins is started without its full path The patch uses 'execvp' instead of 'execv' to lookup the java executable filename in the PATH if the specified filename does not contain a slash character. Regression introduced in 547d4ed8d35de6be4b2788e4816019bb8cc94902 (cherry picked from commit 3ddd2b0c0876239316b5cfc6bca497821bd200b8)

            Unassigned Unassigned
            simix Simon Matter
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: