When running as a Windows service, Jenkins is unable to restart itself after installing/upgrading plugins or running /restart. The tail of jenkins.err.log reads:

      """
      WARNING: Failed to restart Hudson
      java.io.IOException: Restarting a service
      [Jenkins] $ "C:\Program Files (x86)\Jenkins\jenkins.exe" restart

      at hudson.lifecycle.WindowsServiceLifecycle.restart(WindowsServiceLifecycle.java:135)
      at jenkins.model.Jenkins$23.run(Jenkins.java:3288)
      """

      Additionally, jenkins.wrapper.log shows the following error:

      """
      2014-04-16 16:54:57 - Starting C:\Program Files (x86)\Jenkins\jre\bin\java -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "C:\Program Files (x86)\Jenkins\jenkins.war" --httpPort=8080
      2014-04-16 16:54:57 - Started 1796
      2014-04-17 18:14:19 - Stopping jenkins
      2014-04-17 18:14:19 - ProcessKill 1796
      2014-04-17 18:14:19 - Send SIGINT 1796
      2014-04-17 18:14:19 - SIGINT to1796 successful
      2014-04-17 18:14:19 - Send SIGINT 1796
      2014-04-17 18:14:19 - SIGINT to 1796 failed - Killing as fallback
      2014-04-17 18:14:19 - Finished jenkins
      """

      On previous versions of Jenkins, none of the lines with "SIGINT" are present, and restart works as expected.

      Seeing this issue on two different Windows machines. Can be tested with a stock installation of jenkins-1.559.msi. After Jenkins is installed, go to localhost:8080/restart and restart. The Jenkins service will stop but not restart, and the above error can be seen in the err log.

      Went back and tested 1.549, 1.554, 1.557 and 1.558. None of these exhibited this problem. Reinstalled 1.559, and saw the problem immediately.

      Work-around is to run Windows Services manager and manually restart Jenkins service.

          [JENKINS-22685] Jenkins cannot restart Windows service

          I still have the same service restarting problem in 1.565.1 (Java Version 7 Update 67), so I can't consider it fixed. As for now I'm staying on 1.554.2 without this problem.

          Johnson Birdman added a comment - I still have the same service restarting problem in 1.565.1 (Java Version 7 Update 67), so I can't consider it fixed. As for now I'm staying on 1.554.2 without this problem.

          Having the same problem with 1.565.1, running as windows service. Also stuck at "Please wait while Jenkins is restarting ..."

          Michael Glauche added a comment - Having the same problem with 1.565.1, running as windows service. Also stuck at "Please wait while Jenkins is restarting ..."

          Daniel Beck added a comment -

          Are you running Jenkins as a non-default user? Maybe one who's not allowed to restart services? Try to give that user permission to use WMI:

          http://technet.microsoft.com/en-us/library/cc787533%28v=WS.10%29.aspx

          I'm asking, because in the default setup, it works for me:

          Tried with 1.576 on Windows 8.1 Pro installed with the installer. Restart works without issues.

          2014-08-21 17:41:00 - Starting C:\Program Files (x86)\Jenkins\jre\bin\java -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "C:\Program Files (x86)\Jenkins\jenkins.war" --httpPort=8080
          2014-08-21 17:41:00 - Started 4088
          2014-08-21 17:42:26 - Stopping jenkins
          2014-08-21 17:42:26 - ProcessKill 4088
          2014-08-21 17:42:26 - Send SIGINT 4088
          2014-08-21 17:42:26 - SIGINT to 4088 failed - Killing as fallback
          2014-08-21 17:42:26 - Send SIGINT 4088
          2014-08-21 17:42:26 - SIGINT to 4088 failed - Killing as fallback
          2014-08-21 17:42:26 - Finished jenkins
          2014-08-21 17:42:28 - Starting C:\Program Files (x86)\Jenkins\jre\bin\java -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "C:\Program Files (x86)\Jenkins\jenkins.war" --httpPort=8080
          2014-08-21 17:42:28 - Started 568

          Web UI was available again as well.

          Then I tried 1.565.1 on the same machine (after resetting the VM to before I installed 1.576).

          Again it worked like a charm.

          Daniel Beck added a comment - Are you running Jenkins as a non-default user? Maybe one who's not allowed to restart services? Try to give that user permission to use WMI: http://technet.microsoft.com/en-us/library/cc787533%28v=WS.10%29.aspx I'm asking, because in the default setup, it works for me: Tried with 1.576 on Windows 8.1 Pro installed with the installer. Restart works without issues. 2014-08-21 17:41:00 - Starting C:\Program Files (x86)\Jenkins\jre\bin\java -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "C:\Program Files (x86)\Jenkins\jenkins.war" --httpPort=8080 2014-08-21 17:41:00 - Started 4088 2014-08-21 17:42:26 - Stopping jenkins 2014-08-21 17:42:26 - ProcessKill 4088 2014-08-21 17:42:26 - Send SIGINT 4088 2014-08-21 17:42:26 - SIGINT to 4088 failed - Killing as fallback 2014-08-21 17:42:26 - Send SIGINT 4088 2014-08-21 17:42:26 - SIGINT to 4088 failed - Killing as fallback 2014-08-21 17:42:26 - Finished jenkins 2014-08-21 17:42:28 - Starting C:\Program Files (x86)\Jenkins\jre\bin\java -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "C:\Program Files (x86)\Jenkins\jenkins.war" --httpPort=8080 2014-08-21 17:42:28 - Started 568 Web UI was available again as well. Then I tried 1.565.1 on the same machine (after resetting the VM to before I installed 1.576). Again it worked like a charm.

          Jan Klass added a comment -

          I also have the issue on a 1.565.1 installation.

          Jenkins.exe is running as user SYSTEM. I guess it should be able to restart services then!? (Not sure where to find WMI and its service permissions).

          Jan Klass added a comment - I also have the issue on a 1.565.1 installation. Jenkins.exe is running as user SYSTEM. I guess it should be able to restart services then!? (Not sure where to find WMI and its service permissions).

          Jan Klass added a comment -

          Is the Jenkins auto-war-update sufficient? Or do I need to download and install Jenkins again (where I guess I would get a new Jenkins.exe)?

          Jan Klass added a comment - Is the Jenkins auto-war-update sufficient? Or do I need to download and install Jenkins again (where I guess I would get a new Jenkins.exe)?

          Jan Klass added a comment -

          Indeed; replacing just the jenkins.exe with the one inside the 1.565.1 distribution zip makes the restart work again.
          I guess the other reports here likely come from the same misunderstanding. Merely (auto-)upgrading Jenkins (=replacing the war) is not enough.

          Jan Klass added a comment - Indeed; replacing just the jenkins.exe with the one inside the 1.565.1 distribution zip makes the restart work again. I guess the other reports here likely come from the same misunderstanding. Merely (auto-)upgrading Jenkins (=replacing the war) is not enough.

          > Merely (auto-)upgrading Jenkins (=replacing the war) is not enough.

          Thanks for the clarification!

          Sebastian Schuberth added a comment - > Merely (auto-)upgrading Jenkins (=replacing the war) is not enough. Thanks for the clarification!

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: pom.xml http://jenkins-ci.org/commit/windows-slave-installer-module/95206829480d66058fedf75d781358166374142a Log: Update to winsw-1.18 Changes: https://github.com/kohsuke/winsw/issues?q=milestone%3Awinsw-1.17 and https://github.com/kohsuke/winsw/commit/2bf9e858a94c7caca41812d644543e61ba1c179e Jenkins issues: JENKINS-10547 , JENKINS-22685

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: war/pom.xml http://jenkins-ci.org/commit/jenkins/22d9db09d56c1caa2a8a3e008e6bd29f5c9ed395 Log: Update windows-slave-installer dependency to 1.5.1 Jenkins issues: JENKINS-10547 , JENKINS-22685 Changes in winsw: https://github.com/kohsuke/winsw/issues?q=milestone%3Awinsw-1.17 kohsuke/winsw@2bf9e85 Changes in the module: https://github.com/jenkinsci/windows-slave-installer-module/commit/a4d2121812fe9fe1b38bbe9d2cb57b9cd5435a0d https://github.com/jenkinsci/windows-slave-installer-module/commit/3fbc8434aba05d5d36f52f345d9d0176e98459be

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          war/pom.xml
          http://jenkins-ci.org/commit/jenkins/ddfe4d207750352f123bfb510db70c0ea0820ebe
          Log:
          Merge pull request #1832 from oleg-nenashev/windows-slave-installer-1.5

          [JENKINS-10547, JENKINS-22685] Update windows-slave-installer dependency to 1.5

          Compare: https://github.com/jenkinsci/jenkins/compare/d86a88ab042c...ddfe4d207750

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: war/pom.xml http://jenkins-ci.org/commit/jenkins/ddfe4d207750352f123bfb510db70c0ea0820ebe Log: Merge pull request #1832 from oleg-nenashev/windows-slave-installer-1.5 [JENKINS-10547, JENKINS-22685] Update windows-slave-installer dependency to 1.5 Compare: https://github.com/jenkinsci/jenkins/compare/d86a88ab042c...ddfe4d207750

            sdcgm JCK
            sdcgm JCK
            Votes:
            6 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated:
              Resolved: