Issue
Your controller installed in a Windows OS fails to restart with a stack trace compatible with the one shown below:
XXXX-XX-XX XXXX [id=XX] INFO jenkins.model.Jenkins#cleanUp: Jenkins stopped XXXX-XX-XX XXXX [id=XX] WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. XXXX-XX-XX XXXX [id=XX] WARNING o.e.jetty.server.HttpChannel#handleException: /tcpSlaveAgentListener/java.lang.IllegalStateException: Jenkins.instance is missing.
Resolution
This error has been reported in some versions of Jenkins, and has been discussed and solved in JENKINS-59992. The fix was included in Jenkins LTS 2.223.
So the proper fix for the issue is to upgrade to a version of the product which is higher than 2.223.
Workaround
The workaround is to manually restart the Windows service in order to get the instance successfully restarted.
This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.