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

Got IllegalStateException while restart Jenkins

    • Jenkins 2.185

      Hi oleg_nenashev 
      I'm using Jenkins version 2.162
      When I restart jenkins using /restart command or after plugin installation I got the following error at Jenkins restart page:

      Stack tracejava.lang.IllegalStateException: Expected 1 instance of hudson.model.User$AllUsers but got 0
      	at hudson.ExtensionList.lookupSingleton(ExtensionList.java:450)
      	at hudson.model.User$AllUsers.getInstance(User.java:1084)
      	at hudson.model.User$AllUsers.get(User.java:1102)
      	at hudson.model.User$AllUsers.access$100(User.java:1065)
      	at hudson.model.User.getOrCreateById(User.java:521)
      	at hudson.model.User.getById(User.java:619)
      	at hudson.security.HttpSessionContextIntegrationFilter2.hasInvalidSessionSeed(HttpSessionContextIntegrationFilter2.java:87)
      	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:60)
      	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)
      	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(Thread.java:748)
      

      As I see frontend part scripts/loading.js:53 sent GET request to server URL and got 500 code. 

      The normal behaviour of  loading.js:41 should get 503 code from the server

          [JENKINS-55945] Got IllegalStateException while restart Jenkins

          Artem Fedorov created issue -

          Oleg Nenashev added a comment -

          Hi. I see the ticket, but I have no bandwidth to process it right now.

          Will unassign the ticket so that others can work on it if they have some time

          Oleg Nenashev added a comment - Hi. I see the ticket, but I have no bandwidth to process it right now. Will unassign the ticket so that others can work on it if they have some time
          Oleg Nenashev made changes -
          Assignee Original: Oleg Nenashev [ oleg_nenashev ]

          Pavel Roskin added a comment -

          I got this when I loaded a locally compiled version of the Stash pull request builder plugin and selected the "Restart Jenkins" checkbox. I saw that message. I reloaded the page after a few seconds, Jenkins is working normally. Jenkins 2.164 in Docker.

          Pavel Roskin added a comment - I got this when I loaded a locally compiled version of the Stash pull request builder plugin and selected the "Restart Jenkins" checkbox. I saw that message. I reloaded the page after a few seconds, Jenkins is working normally. Jenkins 2.164 in Docker.

          Getting this when restarting after updating a plugin. Clicking the checkbox for restarting jenkins when no jobs are running, will immediately produce this error.

          However, if I wait for Jenkins to restart, it will eventually restart properly.

          This is on a brand new Jenkins installation using the official docker image on an Ubuntu 18.04 EC2 instance.

          Michael Sanders added a comment - Getting this when restarting after updating a plugin. Clicking the checkbox for restarting jenkins when no jobs are running, will immediately produce this error. However, if I wait for Jenkins to restart, it will eventually restart properly. This is on a brand new Jenkins installation using the official docker image on an Ubuntu 18.04 EC2 instance.

          Boyd Smith added a comment -

          Like urinalcake, I received this error when clicking the "Restart jenkins when no jobs are running" from the pluginManager/updatePlugins area.

          Boyd Smith added a comment - Like urinalcake , I received this error when clicking the "Restart jenkins when no jobs are running" from the pluginManager/updatePlugins area.

          mike mancini added a comment -

          I also encounter this in the same context as Boyd and Michael - a workaround for me was to log out, log back in, and then hit the /restart endpoint.

          mike mancini added a comment - I also encounter this in the same context as Boyd and Michael - a workaround for me was to log out, log back in, and then hit the /restart endpoint.

          Tor Mala added a comment -

          I get the same behaviour. Fresh install on AWS ubuntu 18.04 installing version 2.164.1

          I have set locale to en_US.UTF8

          I also get errors when I try to create user with passwords containing characters outside ASCII

          Tor Mala added a comment - I get the same behaviour. Fresh install on AWS ubuntu 18.04 installing version 2.164.1 I have set locale to en_US.UTF8 I also get errors when I try to create user with passwords containing characters outside ASCII

          Pavel Roskin added a comment -

          I understand the reason is an attempt to authenticate the http request after the user list is destroyed. A simple fix would be to catch IllegalStateException in User#getOrCreateById and return null. A better solution would be to create a nullable ExtensionList#lookupSingletonOrNull, use it from User.java and handle null properly in all callers.

           

          Pavel Roskin added a comment - I understand the reason is an attempt to authenticate the http request after the user list is destroyed. A simple fix would be to catch IllegalStateException in User#getOrCreateById and return null. A better solution would be to create a nullable ExtensionList#lookupSingletonOrNull , use it from User.java and handle null properly in all callers.  

          Casey Wise added a comment -

          Getting this attempting to configure a new install on Windows.  Installed the following plugins when I saw this first.

          • GitHub
          • Bitbucket

          Casey Wise added a comment - Getting this attempting to configure a new install on Windows.  Installed the following plugins when I saw this first. GitHub Bitbucket

            jthompson Jeff Thompson
            artem_fedorov Artem Fedorov
            Votes:
            17 Vote for this issue
            Watchers:
            30 Start watching this issue

              Created:
              Updated: