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

"Jenkins.instance is missing" error when restarting Jenkins

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • Windows Server 2016
      Java 1.8.0_191-b12
      Jenkins 2.150.1
    • Jenkins 2.223

      Sometimes when I try to restart Jenkins (eg. after upgrading the plugins), it just starts returning HTTP 500 errors, and I need to restart the Jenkins service.

      When this happens, I see lots of these errors in the logs:

      Dec 07, 2018 12:03:45 AM org.eclipse.jetty.server.HttpChannel handleException
      WARNING: /
      java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong.
       at jenkins.model.Jenkins.get(Jenkins.java:758)
       at hudson.init.impl.InstallUncaughtExceptionHandler.lambda$init$0(InstallUncaughtExceptionHandler.java:36)
       at org.kohsuke.stapler.compression.CompressionFilter.reportException(CompressionFilter.java:77)
       at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:58)
       at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
       at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
       at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
       at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
       at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
       at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
       at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
       at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
       at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
       at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
       at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
       at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
       at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
       at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
       at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
       at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
       at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
       at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
       at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
       at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
       at org.eclipse.jetty.server.Server.handle(Server.java:503)
       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
       at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
       at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
       at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
       at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
       at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
       at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
       at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
       at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
       at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
       at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
       at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
       at java.lang.Thread.run(Unknown Source)

       

          [JENKINS-55070] "Jenkins.instance is missing" error when restarting Jenkins

          Daniel Lo Nigro created issue -

          Daniel Beck added a comment -

          This happens after other errors. Look for those.

          Daniel Beck added a comment - This happens after other errors. Look for those.

          I saw this again today while restarting after installing a plugin... I didn't see any other errors before it though. Seems like it happens after "INFO: Jenkins stopped" and then it doesn't restart properly?

          I did see "java.lang.IllegalStateException: Error already set" and "java.lang.NullPointerException at hudson.security.TokenBasedRememberMeServices2.autoLogin" errors in the stack of the second instance of the error though.

          Dec 07, 2018 9:40:48 PM jenkins.model.Jenkins$23 run
          INFO: Restart in 10 seconds
          Dec 07, 2018 9:40:58 PM jenkins.model.Jenkins$23 run
          INFO: Restarting VM as requested by daniel15
          Dec 07, 2018 9:40:58 PM jenkins.model.Jenkins cleanUp
          INFO: Stopping Jenkins
          Dec 07, 2018 9:40:58 PM jenkins.model.Jenkins$18 onAttained
          INFO: Started termination
          Dec 07, 2018 9:40:58 PM jenkins.model.Jenkins$18 onAttained
          INFO: Completed termination
          Dec 07, 2018 9:40:58 PM jenkins.model.Jenkins _cleanUpDisconnectComputers
          INFO: Starting node disconnection
          Dec 07, 2018 9:40:59 PM jenkins.model.Jenkins _cleanUpShutdownPluginManager
          INFO: Stopping plugin manager
          Dec 07, 2018 9:40:59 PM jenkins.model.Jenkins _cleanUpPersistQueue
          INFO: Persisting build queue
          Dec 07, 2018 9:40:59 PM jenkins.model.Jenkins _cleanUpAwaitDisconnects
          INFO: Waiting for node disconnection completion
          Dec 07, 2018 9:40:59 PM jenkins.model.Jenkins cleanUp
          INFO: Jenkins stopped
          Dec 07, 2018 9:42:45 PM org.eclipse.jetty.server.HttpChannel handleException
          WARNING: /
          java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong.
          	at jenkins.model.Jenkins.get(Jenkins.java:758)
          	at hudson.init.impl.InstallUncaughtExceptionHandler.lambda$init$0(InstallUncaughtExceptionHandler.java:36)
          	at org.kohsuke.stapler.compression.CompressionFilter.reportException(CompressionFilter.java:77)
          	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:58)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
          	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
          	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
          	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
          	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
          	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
          	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
          	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
          	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
          	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
          	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
          	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
          	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
          	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
          	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
          	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
          	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
          	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
          	at org.eclipse.jetty.server.Server.handle(Server.java:503)
          	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
          	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
          	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
          	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
          	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
          	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
          	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
          	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
          	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
          	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
          	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
          	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
          	at java.lang.Thread.run(Unknown Source)Dec 07, 2018 9:42:45 PM org.eclipse.jetty.server.HttpChannel handleException
          WARNING: ERROR dispatch failed
          java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong.
          	at jenkins.model.Jenkins.get(Jenkins.java:758)
          	at hudson.init.impl.InstallUncaughtExceptionHandler.lambda$init$0(InstallUncaughtExceptionHandler.java:36)
          	at org.kohsuke.stapler.compression.CompressionFilter.reportException(CompressionFilter.java:77)
          	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:58)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
          	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
          	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
          	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
          	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
          	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
          	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
          	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
          	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
          	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
          	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
          	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
          	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
          	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
          	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
          	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
          	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
          	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
          	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
          	at org.eclipse.jetty.server.Server.handle(Server.java:503)
          	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
          	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
          	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
          	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
          	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
          	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
          	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
          	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
          	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
          	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
          	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
          	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
          	at java.lang.Thread.run(Unknown Source)
          	Suppressed: java.lang.IllegalStateException: Error already set
          		at org.eclipse.jetty.server.HttpChannelState.onError(HttpChannelState.java:758)
          		at org.eclipse.jetty.server.HttpChannel.handleException(HttpChannel.java:590)
          		at org.eclipse.jetty.server.HttpChannelOverHttp.handleException(HttpChannelOverHttp.java:489)
          		at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:526)
          		... 12 more
          	Caused by: java.lang.NullPointerException
          		at hudson.security.TokenBasedRememberMeServices2.autoLogin(TokenBasedRememberMeServices2.java:126)
          		at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:104)
          		at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
          		at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
          		at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
          		at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
          		at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
          		at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
          		at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
          		at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
          		at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
          		at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
          		at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
          		at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
          		at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
          		at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
          		at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
          		at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
          		at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
          		at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
          		at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
          		at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
          		at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
          		at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
          		at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
          		at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
          		at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
          		at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
          		at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
          		at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
          		at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
          		at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
          		at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
          		at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
          		at org.eclipse.jetty.server.Server.handle(Server.java:503)
          		at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
          		... 12 more
          

          Daniel Lo Nigro added a comment - I saw this again today while restarting after installing a plugin... I didn't see any other errors before it though. Seems like it happens after "INFO: Jenkins stopped" and then it doesn't restart properly? I did see "java.lang.IllegalStateException: Error already set" and "java.lang.NullPointerException at hudson.security.TokenBasedRememberMeServices2.autoLogin" errors in the stack of the second instance of the error though. Dec 07, 2018 9:40:48 PM jenkins.model.Jenkins$23 run INFO: Restart in 10 seconds Dec 07, 2018 9:40:58 PM jenkins.model.Jenkins$23 run INFO: Restarting VM as requested by daniel15 Dec 07, 2018 9:40:58 PM jenkins.model.Jenkins cleanUp INFO: Stopping Jenkins Dec 07, 2018 9:40:58 PM jenkins.model.Jenkins$18 onAttained INFO: Started termination Dec 07, 2018 9:40:58 PM jenkins.model.Jenkins$18 onAttained INFO: Completed termination Dec 07, 2018 9:40:58 PM jenkins.model.Jenkins _cleanUpDisconnectComputers INFO: Starting node disconnection Dec 07, 2018 9:40:59 PM jenkins.model.Jenkins _cleanUpShutdownPluginManager INFO: Stopping plugin manager Dec 07, 2018 9:40:59 PM jenkins.model.Jenkins _cleanUpPersistQueue INFO: Persisting build queue Dec 07, 2018 9:40:59 PM jenkins.model.Jenkins _cleanUpAwaitDisconnects INFO: Waiting for node disconnection completion Dec 07, 2018 9:40:59 PM jenkins.model.Jenkins cleanUp INFO: Jenkins stopped Dec 07, 2018 9:42:45 PM org.eclipse.jetty.server.HttpChannel handleException WARNING: / java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong. at jenkins.model.Jenkins.get(Jenkins.java:758) at hudson.init.impl.InstallUncaughtExceptionHandler.lambda$init$0(InstallUncaughtExceptionHandler.java:36) at org.kohsuke.stapler.compression.CompressionFilter.reportException(CompressionFilter.java:77) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:58) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:503) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683) at java.lang. Thread .run(Unknown Source)Dec 07, 2018 9:42:45 PM org.eclipse.jetty.server.HttpChannel handleException WARNING: ERROR dispatch failed java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong. at jenkins.model.Jenkins.get(Jenkins.java:758) at hudson.init.impl.InstallUncaughtExceptionHandler.lambda$init$0(InstallUncaughtExceptionHandler.java:36) at org.kohsuke.stapler.compression.CompressionFilter.reportException(CompressionFilter.java:77) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:58) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:503) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683) at java.lang. Thread .run(Unknown Source) Suppressed: java.lang.IllegalStateException: Error already set at org.eclipse.jetty.server.HttpChannelState.onError(HttpChannelState.java:758) at org.eclipse.jetty.server.HttpChannel.handleException(HttpChannel.java:590) at org.eclipse.jetty.server.HttpChannelOverHttp.handleException(HttpChannelOverHttp.java:489) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:526) ... 12 more Caused by: java.lang.NullPointerException at hudson.security.TokenBasedRememberMeServices2.autoLogin(TokenBasedRememberMeServices2.java:126) at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:104) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249) at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:503) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364) ... 12 more

          Daniel Beck added a comment -

          Yep, Jenkins apparently cannot restart itself, and just stopped.

          Potential problem with winsw / how you run Jenkins. Check the Windows event log, the Jenkins service log, and provide complete information how and when (what version originally) Jenkins was installed.

          Poking oleg_nenashev in case he's still maintaining winsw.

          Daniel Beck added a comment - Yep, Jenkins apparently cannot restart itself, and just stopped. Potential problem with winsw / how you run Jenkins. Check the Windows event log, the Jenkins service log, and provide complete information how and when (what version originally) Jenkins was installed. Poking oleg_nenashev in case he's still maintaining winsw .

          Oleg Nenashev added a comment -

          danielbeck yes, I somewhat maintain it. Though I do not see evidence that the issue caused by WinSW:

           

           

          Caused by: java.lang.NullPointerException
          		at hudson.security.TokenBasedRememberMeServices2.autoLogin(TokenBasedRememberMeServices2.java:126)
          		at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:104)
          		at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
          		at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
          		at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
          		at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
          

          Due to whatever reason the autoLogin() logic is invoked before Jenkins holder class is fully initialized: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/security/TokenBasedRememberMeServices2.java#L126 . This is a regression caused by the SECURITY-996 fix in this commit by wfollonierhttps://github.com/jenkinsci/jenkins/commit/ef9583a24abc4de157e1570cb32d7a273d327f36 

           

           

           

          Oleg Nenashev added a comment - danielbeck yes, I somewhat maintain it. Though I do not see evidence that the issue caused by WinSW:     Caused by: java.lang.NullPointerException at hudson.security.TokenBasedRememberMeServices2.autoLogin(TokenBasedRememberMeServices2.java:126) at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:104) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93) Due to whatever reason the autoLogin() logic is invoked before Jenkins holder class is fully initialized: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/security/TokenBasedRememberMeServices2.java#L126 . This is a regression caused by the SECURITY-996 fix in this commit by wfollonier :  https://github.com/jenkinsci/jenkins/commit/ef9583a24abc4de157e1570cb32d7a273d327f36        
          Oleg Nenashev made changes -
          Labels New: regression
          Oleg Nenashev made changes -
          Assignee New: Wadeck Follonier [ wfollonier ]

          Oleg Nenashev added a comment -

          The root exception is also a bug IMHO, but it existed in the code for a while

          java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong.
          	at jenkins.model.Jenkins.get(Jenkins.java:758)
                  at hudson.init.impl.InstallUncaughtExceptionHandler.lambda$init$0(InstallUncaughtExceptionHandler.java:36)
          

          Instead of invoking Jenkins.get(), the code should use the Jenkins instance passed by the initializer

          For me it's hard to say what is a root cause, but we really need to cleanup the code a bit

          Oleg Nenashev added a comment - The root exception is also a bug IMHO, but it existed in the code for a while java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong. at jenkins.model.Jenkins.get(Jenkins.java:758) at hudson.init.impl.InstallUncaughtExceptionHandler.lambda$init$0(InstallUncaughtExceptionHandler.java:36) Instead of invoking Jenkins.get(), the code should use the Jenkins instance passed by the initializer For me it's hard to say what is a root cause, but we really need to cleanup the code a bit

          Daniel Beck added a comment -

          This does not look like it would affect a Jenkins restart. Note this occurred two minutes after Jenkins was stopped as part of a restart.

          Daniel Beck added a comment - This does not look like it would affect a Jenkins restart. Note this occurred two minutes after Jenkins was stopped as part of a restart.

          Daniel Lo Nigro added a comment - - edited

          Check the Windows event log, the Jenkins service log, and provide complete information how and when (what version originally) Jenkins was installed.

          danielbeck - I originally installed Jenkins 2.138.3 via the Windows installer. The only change I've made is that I've changed the service to run as a separate Jenkins user rather than as SYSTEM for better security (maybe that's causing issues?).

          I do see some errors like this in the Event Viewer:

          SIGINT to 6536 failed - Killing as fallback

          What is the "Jenkins service log"? Is that different to the C:\Program Files (x86)\Jenkins\jenkins.err.log file I've been looking at?

           

          Daniel Lo Nigro added a comment - - edited Check the Windows event log, the Jenkins service log, and provide complete information how and when (what version originally) Jenkins was installed. danielbeck - I originally installed Jenkins 2.138.3 via the Windows installer. The only change I've made is that I've changed the service to run as a separate Jenkins user rather than as SYSTEM for better security (maybe that's causing issues?). I do see some errors like this in the Event Viewer: SIGINT to 6536 failed - Killing as fallback What is the "Jenkins service log"? Is that different to the C:\Program Files (x86)\Jenkins\jenkins.err.log file I've been looking at?  

            wfollonier Wadeck Follonier
            daniel15 Daniel Lo Nigro
            Votes:
            4 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: