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

"Jenkins.instance is missing" error when restarting Jenkins

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: core
    • Labels:
    • Environment:
      Windows Server 2016
      Java 1.8.0_191-b12
      Jenkins 2.150.1
    • Similar Issues:

      Description

      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)

       

        Attachments

          Issue Links

            Activity

            Hide
            wfollonier Wadeck Follonier added a comment -
            Show
            wfollonier Wadeck Follonier added a comment - First analysis explained in https://issues.jenkins-ci.org/browse/JENKINS-59992?focusedCommentId=379193&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-379193 about a potential root cause. No plan to work more on this from my side.
            Hide
            ethorsa ethorsa added a comment -

            Since my Upgrade from Oracle Java 8 to AdoptOpenJDK 11 I run into this problem too. The Jenkins log fills with following error, eventually crashing the server:

             

            WARNING	o.e.jetty.server.HttpChannel#handleException: ERROR dispatch failed
            Also:   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:773)
            		at hudson.security.TokenBasedRememberMeServices2.autoLogin(TokenBasedRememberMeServices2.java:164)
            		at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:104)
            		at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
            [...]

            (Full log excerpt of this error attached)

            After first appearance of this error it's no longer possible to start Jenkins. Executing a full reboot of the host brings it up again.

             

            The Windows event log does not contain any useful information (only "exited with 1").

            Jenkins Master:

            • Jenkins v2.190.3
            • AdoptOpenJDK 11.0.4
            • Windows 7
            Show
            ethorsa ethorsa added a comment - Since my Upgrade from Oracle Java 8 to AdoptOpenJDK 11 I run into this problem too. The Jenkins log fills with following error, eventually crashing the server:   WARNING o.e.jetty.server.HttpChannel#handleException: ERROR dispatch failed Also: 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:773) at hudson.security.TokenBasedRememberMeServices2.autoLogin(TokenBasedRememberMeServices2.java:164) at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:104) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) [...] (Full log excerpt of this error attached) After first appearance of this error it's no longer possible to start Jenkins. Executing a full reboot of the host brings it up again.   The Windows event log does not contain any useful information (only "exited with 1" ). Jenkins Master: Jenkins v2.190.3 AdoptOpenJDK 11.0.4 Windows 7
            Hide
            csclutgen Craig Lutgen added a comment -

            It is the exact same symptom and the exactly the same stack trace that was never resolved and forgotten about. So, one should consider it the same bug. And who is to say that other users aren't regularly seeing this problem. All the same, please reference new issue JENKINS-59992. We cannot supply full logs for security reason. But, let me know if there are specific items that could be provied.

            Show
            csclutgen Craig Lutgen added a comment - It is the exact same symptom and the exactly the same stack trace that was never resolved and forgotten about. So, one should consider it the same bug. And who is to say that other users aren't regularly seeing this problem. All the same, please reference new issue JENKINS-59992 . We cannot supply full logs for security reason. But, let me know if there are specific items that could be provied.
            Hide
            danielbeck Daniel Beck added a comment -

            Craig Lutgen It's almost a year later, and you haven't previously been involved in this issue. It's also not a problem users regularly encounter. It's therefore possible, perhaps likely, that your problem is not the exact same, so please file a new issue and provide as much information about your setup as possible (see guidelines linked from Create Issue form).

            Show
            danielbeck Daniel Beck added a comment - Craig Lutgen It's almost a year later, and you haven't previously been involved in this issue. It's also not a problem users regularly encounter. It's therefore possible, perhaps likely, that your problem is not the exact same, so please file a new issue and provide as much information about your setup as possible (see guidelines linked from Create Issue form).
            Hide
            csclutgen Craig Lutgen added a comment -

            This still happens. Every restart from an upgrade or otherwise gets stuck with the Jenkins.instance is missing exception and requires a service restart.

             

            Jenkins v 2.202

            Windows Server 2016

            Java 1.8.0_221-b11

            Show
            csclutgen Craig Lutgen added a comment - This still happens. Every restart from an upgrade or otherwise gets stuck with the Jenkins.instance is missing exception and requires a service restart.   Jenkins v 2.202 Windows Server 2016 Java 1.8.0_221-b11

              People

              • Assignee:
                Unassigned
                Reporter:
                daniel15 Daniel Lo Nigro
              • Votes:
                4 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated: