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

Jenkins won't restart itself through the GUI

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: core
    • Labels:
      None
    • Similar Issues:

      Description

      Jenkins never manage to restart itself after a plugin or version update. It must always be manually restarted through the windows service manager.

      System: Windows XP
      Jenkins 1.563

      ERROR LOG:

      WARNING: Failed to restart Jenkins
      java.io.IOException: Restarting a service
      [Jenkins] $ C:\Program\Jenkins\jenkins.exe restart
      System.UnauthorizedAccessException: ?tkomst nekad. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
      at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
      at System.Management.ManagementScope.InitializeGuts(Object o)
      at System.Management.ManagementScope.Initialize()
      at System.Management.ManagementScope.Connect()
      at WMI.WmiRoot..ctor(String machineName)
      at WMI.WmiRoot..ctor()
      at winsw.WrapperService.Run(String[] _args)
      at winsw.WrapperService.Main(String[] args)

      at hudson.lifecycle.WindowsServiceLifecycle.restart(WindowsServiceLifecycle.java:138)
      at jenkins.model.Jenkins$24.run(Jenkins.java:3336)

        Attachments

          Issue Links

            Activity

            Hide
            leedega Kevin Phillips added a comment - - edited

            I have reproduced this same problem in the latest LTS edition (1.596.3 atm) on a clean Windows 7 x64 OS as well. I'm using Java 64bit v1.7.0_80-b15 in case that is a factor.

            I've tried setting up the Jenkins service to run under the local system account as well as a local administrative user and neither setting works correctly.

            I have confirmed that the command line interface for the service, jenkins.exe, does correctly control the Windows service. Performing "jenkins start", "jenkins stop", "jenkins restart", "jenkins uninstall" and "jenkins install" all work correctly when run from a command prompt using the same local user profile the service runs within.

            I have also tried explicitly adding WMI permissions to all relevant users / groups as well using the process found here in case this was some kind of security problem but that had no effect either.

            Finally, unlike the description above and other defects in the issue tracker like JENKINS-23395 and JENKINS-22685, I see no errors or warnings of any kind related to the service reboot. In fact the only reference to the reboot request at all in any of the logs is this short snippet I found in the jenkins.err.log file:

            Jun 01, 2015 12:10:43 PM jenkins.model.Jenkins$22 run
            SEVERE: Restarting VM as requested by anonymous

            If I try performing a "safe restart" (ie: http://jenkins/safeRestart), the results are the same but I get a couple of extra lines in the error log as shown below:

            May 26, 2015 8:41:05 AM hudson.model.UpdateCenter doSafeRestart
            INFO: Scheduling Jenkins reboot
            May 26, 2015 8:41:05 AM jenkins.model.Jenkins$23 run
            INFO: Restart in 10 seconds
            May 26, 2015 8:41:15 AM jenkins.model.Jenkins$23 run
            SEVERE: Restarting VM as requested by anonymous

            Also, after requesting the reboot, say via the http://jenkins/reboot REST call, the application does mark itself as "preparing for shutdown" but since the reboot never actually happens the service stays in this intermediate state indefinitely. You basically have to log into the server and manually for the service to restart.

            Show
            leedega Kevin Phillips added a comment - - edited I have reproduced this same problem in the latest LTS edition (1.596.3 atm) on a clean Windows 7 x64 OS as well. I'm using Java 64bit v1.7.0_80-b15 in case that is a factor. I've tried setting up the Jenkins service to run under the local system account as well as a local administrative user and neither setting works correctly. I have confirmed that the command line interface for the service, jenkins.exe, does correctly control the Windows service. Performing "jenkins start", "jenkins stop", "jenkins restart", "jenkins uninstall" and "jenkins install" all work correctly when run from a command prompt using the same local user profile the service runs within. I have also tried explicitly adding WMI permissions to all relevant users / groups as well using the process found here in case this was some kind of security problem but that had no effect either. Finally, unlike the description above and other defects in the issue tracker like JENKINS-23395 and JENKINS-22685 , I see no errors or warnings of any kind related to the service reboot. In fact the only reference to the reboot request at all in any of the logs is this short snippet I found in the jenkins.err.log file: Jun 01, 2015 12:10:43 PM jenkins.model.Jenkins$22 run SEVERE: Restarting VM as requested by anonymous If I try performing a "safe restart" (ie: http://jenkins/safeRestart ), the results are the same but I get a couple of extra lines in the error log as shown below: May 26, 2015 8:41:05 AM hudson.model.UpdateCenter doSafeRestart INFO: Scheduling Jenkins reboot May 26, 2015 8:41:05 AM jenkins.model.Jenkins$23 run INFO: Restart in 10 seconds May 26, 2015 8:41:15 AM jenkins.model.Jenkins$23 run SEVERE: Restarting VM as requested by anonymous Also, after requesting the reboot, say via the http://jenkins/reboot REST call, the application does mark itself as "preparing for shutdown" but since the reboot never actually happens the service stays in this intermediate state indefinitely. You basically have to log into the server and manually for the service to restart.
            Hide
            leedega Kevin Phillips added a comment -

            One other strategy I tried to work around this issue was to move the Jenkins installation folder to different locations, thinking that maybe putting it under Program Files may have caused some permission issues or something. However even if I relocate the folder to a new folder off the root partition (ie: c:\jenkins ) the same behavior ensues.

            I only mention it here just in case this helps isolate the cause of the problem.

            Show
            leedega Kevin Phillips added a comment - One other strategy I tried to work around this issue was to move the Jenkins installation folder to different locations, thinking that maybe putting it under Program Files may have caused some permission issues or something. However even if I relocate the folder to a new folder off the root partition (ie: c:\jenkins ) the same behavior ensues. I only mention it here just in case this helps isolate the cause of the problem.
            Hide
            pixman20 pixman20 added a comment -

            I am also having this problem and unfortunately do not have time to debug it further at the moment.
            I had to shutdown the service and then manually kill the java.exe process before restarting the service to get Jenkins to start.
            In case it helps:
            I'm running 1.606 on Windows Server 2008 R2
            I have several slaves running via SSH (I noticed their respective java.exe processs were still running after /safeRestart)
            I have many (at least 70) different plugins activated, which may also be related to the problem if this is not occuring within a core only environment.

            Show
            pixman20 pixman20 added a comment - I am also having this problem and unfortunately do not have time to debug it further at the moment. I had to shutdown the service and then manually kill the java.exe process before restarting the service to get Jenkins to start. In case it helps: I'm running 1.606 on Windows Server 2008 R2 I have several slaves running via SSH (I noticed their respective java.exe processs were still running after /safeRestart) I have many (at least 70) different plugins activated, which may also be related to the problem if this is not occuring within a core only environment.
            Hide
            chamelespoon Rob Davies added a comment -

            I'm seeing this issue with the latest version of Jenkins (1.655); seeing the same log messages as Kevin has list above.

            I believe it worked correctly when running the service as it was initially installed under the local system account, but changing the service to run under a specified user account (needed for publishing builds to Azure) has stopped the auto-restart working.

            For the most part, restarting the service manually on the build server works, although I do occasionally need to kill the Java process as it's holding open the ports Jenkins is trying to bind to.

            For info:

            • Running a single instance; no slaves
            • Running v1.655 on Windows Server 2008 R2
            • There are ~25 non-stock plugins installed
            Show
            chamelespoon Rob Davies added a comment - I'm seeing this issue with the latest version of Jenkins (1.655); seeing the same log messages as Kevin has list above. I believe it worked correctly when running the service as it was initially installed under the local system account, but changing the service to run under a specified user account (needed for publishing builds to Azure) has stopped the auto-restart working. For the most part, restarting the service manually on the build server works, although I do occasionally need to kill the Java process as it's holding open the ports Jenkins is trying to bind to. For info: Running a single instance; no slaves Running v1.655 on Windows Server 2008 R2 There are ~25 non-stock plugins installed
            Hide
            grafi71 Grzegorz Kotarski added a comment - - edited

            I believie I'm experiencing the same issue.
            Jenkins running as windows service under specified user account.
            Restart via CLI does not work either.
            In the jenkins.err.log I can see following info:

            WARNING: Failed to restart Jenkins
            java.io.IOException: Cannot run program "D:\Jenkins\jenkins.exe" (in directory "D:\Jenkins"): CreateProcess error=87, The parameter is incorrect
            	at java.lang.ProcessBuilder.start(Unknown Source)
            	at hudson.Proc$LocalProc.<init>(Proc.java:243)
            	at hudson.Proc$LocalProc.<init>(Proc.java:212)
            	at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
            	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
            	at hudson.Launcher$ProcStarter.join(Launcher.java:388)
            	at hudson.lifecycle.WindowsServiceLifecycle.restart(WindowsServiceLifecycle.java:136)
            	at jenkins.model.Jenkins$26.run(Jenkins.java:4051)
            Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect
            	at java.lang.ProcessImpl.create(Native Method)
            	at java.lang.ProcessImpl.<init>(Unknown Source)
            	at java.lang.ProcessImpl.start(Unknown Source)
            	... 8 more
            

            The system is Windows 2008 server R2, Jenkins 2.19.3

            Show
            grafi71 Grzegorz Kotarski added a comment - - edited I believie I'm experiencing the same issue. Jenkins running as windows service under specified user account. Restart via CLI does not work either. In the jenkins.err.log I can see following info: WARNING: Failed to restart Jenkins java.io.IOException: Cannot run program "D:\Jenkins\jenkins.exe" (in directory "D:\Jenkins"): CreateProcess error=87, The parameter is incorrect at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.<init>(Proc.java:243) at hudson.Proc$LocalProc.<init>(Proc.java:212) at hudson.Launcher$LocalLauncher.launch(Launcher.java:815) at hudson.Launcher$ProcStarter.start(Launcher.java:381) at hudson.Launcher$ProcStarter.join(Launcher.java:388) at hudson.lifecycle.WindowsServiceLifecycle.restart(WindowsServiceLifecycle.java:136) at jenkins.model.Jenkins$26.run(Jenkins.java:4051) Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 8 more The system is Windows 2008 server R2, Jenkins 2.19.3

              People

              • Assignee:
                Unassigned
                Reporter:
                hirre Hirad Asadi
              • Votes:
                5 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated: