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

Got IllegalStateException while restart Jenkins

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      Jenkins 2.185

      Description

      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

        Attachments

          Activity

          artem_fedorov Artem Fedorov created issue -
          Hide
          oleg_nenashev 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

          Show
          oleg_nenashev 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 Oleg Nenashev made changes -
          Field Original Value New Value
          Assignee Oleg Nenashev [ oleg_nenashev ]
          Hide
          proski 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.

          Show
          proski 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.
          Hide
          urinalcake 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.

          Show
          urinalcake 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.
          Hide
          tgcs_bsmith Boyd Smith added a comment -

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

          Show
          tgcs_bsmith Boyd Smith added a comment - Like Michael Sanders , I received this error when clicking the "Restart jenkins when no jobs are running" from the pluginManager/updatePlugins area.
          Hide
          mancini0 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.

          Show
          mancini0 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.
          Hide
          malabar 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

          Show
          malabar 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
          Hide
          proski 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.

           

          Show
          proski 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.  
          Hide
          caseywise 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
          Show
          caseywise 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
          Hide
          arbeita Ronny Borchert added a comment -

          I got this too today. And reverted only in plugins folder the github-branch-source.bak. But now the plugin manager does not show up the new version, strange.

          Show
          arbeita Ronny Borchert added a comment - I got this too today. And reverted only in plugins folder the github-branch-source.bak. But now the plugin manager does not show up the new version, strange.
          Hide
          kapoorlakshya Lakshya Kapoor added a comment - - edited

          I ran into this right after upgrading to 2.164.2 today. Clearing the /caches folder and restarting Jenkins got rid of the error.

          EDIT: The error returns every time I reboot Jenkins after updating a plugin. Manually restarting the service (on Windows) fixes it until the next reboot for plugin updates...

          Show
          kapoorlakshya Lakshya Kapoor added a comment - - edited I ran into this right after upgrading to 2.164.2 today. Clearing the /caches folder and restarting Jenkins got rid of the error. EDIT : The error returns every time I reboot Jenkins after updating a plugin. Manually restarting the service (on Windows) fixes it until the next reboot for plugin updates...
          danielbeck Daniel Beck made changes -
          Labels regression
          jthompson Jeff Thompson made changes -
          Assignee Jeff Thompson [ jthompson ]
          Hide
          jthompson Jeff Thompson added a comment -

          I'm taking a look at this to see if I can figure out what's going on. I haven't had any luck at reproducing it yet. There must be something about timing or configuration. There's probably something a little off about the Jenkins init sequence. If anyone could contribute additional logging, particularly showing init sequence progress, that might be helpful. It might be possible to catch the error here and do something, but without reproduction it's difficult to know if we'd be doing the right thing. Catching it and setting the security context to null would probably work.

          Show
          jthompson Jeff Thompson added a comment - I'm taking a look at this to see if I can figure out what's going on. I haven't had any luck at reproducing it yet. There must be something about timing or configuration. There's probably something a little off about the Jenkins init sequence. If anyone could contribute additional logging, particularly showing init sequence progress, that might be helpful. It might be possible to catch the error here and do something, but without reproduction it's difficult to know if we'd be doing the right thing. Catching it and setting the security context to null would probably work.
          Hide
          proski Pavel Roskin added a comment -

          I can reproduce it every time. I just access the Jenkins URL with "/safeRestart", confirm restart and keep reloading the page every second. It shows the error approximately after 5 to 10 reloads.

          It's interesting that I don't see any stack trace in the console log. Jenkins 2.182 in a Docker container.

           

          2019-06-28 21:20:09.963+0000 [id=318] INFO jenkins.model.Jenkins$23#run: Restart in 10 seconds
          2019-06-28 21:20:19.964+0000 [id=318] INFO jenkins.model.Jenkins$23#run: Restarting VM as requested by roskinp
          2019-06-28 21:20:19.965+0000 [id=318] INFO jenkins.model.Jenkins#cleanUp: Stopping Jenkins
          2019-06-28 21:20:19.983+0000 [id=318] INFO jenkins.model.Jenkins$18#onAttained: Started termination
          2019-06-28 21:20:19.993+0000 [id=318] INFO jenkins.model.Jenkins$18#onAttained: Completed termination
          2019-06-28 21:20:19.993+0000 [id=318] INFO jenkins.model.Jenkins#_cleanUpDisconnectComputers: Starting node disconnection
          2019-06-28 21:20:21.011+0000 [id=318] INFO jenkins.model.Jenkins#_cleanUpShutdownPluginManager: Stopping plugin manager
          2019-06-28 21:20:21.026+0000 [id=318] INFO jenkins.model.Jenkins#_cleanUpPersistQueue: Persisting build queue
          2019-06-28 21:20:21.028+0000 [id=318] INFO jenkins.model.Jenkins#_cleanUpAwaitDisconnects: Waiting for node disconnection completion
          2019-06-28 21:20:21.033+0000 [id=318] INFO jenkins.model.Jenkins#cleanUp: Jenkins stopped
          Running from: /usr/share/jenkins/jenkins-stable.war
          webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
          2019-06-28 21:20:23.482+0000 [id=1] INFO org.eclipse.jetty.util.log.Log#initialized: Logging initialized @595ms to org.eclipse.jetty.util.log.JavaUtilLog
          2019-06-28 21:20:23.606+0000 [id=1] INFO winstone.Logger#logInternal: Beginning extraction from war file
          2019-06-28 21:20:23.642+0000 [id=1] WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
          2019-06-28 21:20:23.704+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: jetty-9.4.z-SNAPSHOT; built: 2019-05-02T00:04:53.875Z; git: e1bc35120a6617ee3df052294e433f3a25ce7097; jvm 1.8.0_181-8u181-b13-2~deb9u1-b13
          2019-06-28 21:20:24.033+0000 [id=1] INFO o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
          2019-06-28 21:20:24.087+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
          2019-06-28 21:20:24.088+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
          2019-06-28 21:20:24.091+0000 [id=1] INFO o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 660000ms
          Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")

           

          Here's what I see on the page. The same Jenkins container.

           

          java.lang.IllegalStateException: Expected 1 instance of hudson.model.User$AllUsers but got 0
          at hudson.ExtensionList.lookupSingleton(ExtensionList.java:451)
          at hudson.model.User$AllUsers.getInstance(User.java:1080)
          at hudson.model.User$AllUsers.get(User.java:1098)
          at hudson.model.User$AllUsers.access$100(User.java:1061)
          at hudson.model.User.getOrCreateById(User.java:517)
          at hudson.model.User.getById(User.java:615)
          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:1610)
          at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
          at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
          at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
          at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
          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:1700)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
          at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
          at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
          at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
          at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
          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:505)
          at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
          at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
          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:117)
          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:698)
          at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)
          at java.lang.Thread.run(Thread.java:748)

          Show
          proski Pavel Roskin added a comment - I can reproduce it every time. I just access the Jenkins URL with "/safeRestart", confirm restart and keep reloading the page every second. It shows the error approximately after 5 to 10 reloads. It's interesting that I don't see any stack trace in the console log. Jenkins 2.182 in a Docker container.   2019-06-28 21:20:09.963+0000 [id=318] INFO jenkins.model.Jenkins$23#run: Restart in 10 seconds 2019-06-28 21:20:19.964+0000 [id=318] INFO jenkins.model.Jenkins$23#run: Restarting VM as requested by roskinp 2019-06-28 21:20:19.965+0000 [id=318] INFO jenkins.model.Jenkins#cleanUp: Stopping Jenkins 2019-06-28 21:20:19.983+0000 [id=318] INFO jenkins.model.Jenkins$18#onAttained: Started termination 2019-06-28 21:20:19.993+0000 [id=318] INFO jenkins.model.Jenkins$18#onAttained: Completed termination 2019-06-28 21:20:19.993+0000 [id=318] INFO jenkins.model.Jenkins#_cleanUpDisconnectComputers: Starting node disconnection 2019-06-28 21:20:21.011+0000 [id=318] INFO jenkins.model.Jenkins#_cleanUpShutdownPluginManager: Stopping plugin manager 2019-06-28 21:20:21.026+0000 [id=318] INFO jenkins.model.Jenkins#_cleanUpPersistQueue: Persisting build queue 2019-06-28 21:20:21.028+0000 [id=318] INFO jenkins.model.Jenkins#_cleanUpAwaitDisconnects: Waiting for node disconnection completion 2019-06-28 21:20:21.033+0000 [id=318] INFO jenkins.model.Jenkins#cleanUp: Jenkins stopped Running from: /usr/share/jenkins/jenkins-stable.war webroot: EnvVars.masterEnvVars.get("JENKINS_HOME") 2019-06-28 21:20:23.482+0000 [id=1] INFO org.eclipse.jetty.util.log.Log#initialized: Logging initialized @595ms to org.eclipse.jetty.util.log.JavaUtilLog 2019-06-28 21:20:23.606+0000 [id=1] INFO winstone.Logger#logInternal: Beginning extraction from war file 2019-06-28 21:20:23.642+0000 [id=1] WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath 2019-06-28 21:20:23.704+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: jetty-9.4.z-SNAPSHOT; built: 2019-05-02T00:04:53.875Z; git: e1bc35120a6617ee3df052294e433f3a25ce7097; jvm 1.8.0_181-8u181-b13-2~deb9u1-b13 2019-06-28 21:20:24.033+0000 [id=1] INFO o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet 2019-06-28 21:20:24.087+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0 2019-06-28 21:20:24.088+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults 2019-06-28 21:20:24.091+0000 [id=1] INFO o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 660000ms Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")   Here's what I see on the page. The same Jenkins container.   java.lang.IllegalStateException: Expected 1 instance of hudson.model.User$AllUsers but got 0 at hudson.ExtensionList.lookupSingleton(ExtensionList.java:451) at hudson.model.User$AllUsers.getInstance(User.java:1080) at hudson.model.User$AllUsers.get(User.java:1098) at hudson.model.User$AllUsers.access$100(User.java:1061) at hudson.model.User.getOrCreateById(User.java:517) at hudson.model.User.getById(User.java:615) 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:1610) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540) 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:1700) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) 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:505) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267) 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:117) 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:698) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804) at java.lang.Thread.run(Thread.java:748)
          Hide
          jthompson Jeff Thompson added a comment -

          I tried that same sequence several times and still couldn't reproduce it. Frustrating.

          One possible approach might be to catch the exception in `hasInvalidSessionSeed()` and return false. That might do the job, but it's hard to be confident without being able to reproduce the issue. One argument against that approach is that the exception is correct – it's in an invalid state. Ignoring it here may just allow it to continue on to other issues. This one, at least, doesn't seem too hazardous. 

          Another possible approach might be to wait here until the system gets into a valid state. That sounds risky.

          What we really need to do is figure out how it got into the invalid state and handle that.

          Show
          jthompson Jeff Thompson added a comment - I tried that same sequence several times and still couldn't reproduce it. Frustrating. One possible approach might be to catch the exception in `hasInvalidSessionSeed()` and return false. That might do the job, but it's hard to be confident without being able to reproduce the issue. One argument against that approach is that the exception is correct – it's in an invalid state. Ignoring it here may just allow it to continue on to other issues. This one, at least, doesn't seem too hazardous.  Another possible approach might be to wait here until the system gets into a valid state. That sounds risky. What we really need to do is figure out how it got into the invalid state and handle that.
          Hide
          proski Pavel Roskin added a comment -

          Yes, I confirm that it works. I patched the code, installed the new jenkins.war, restarted Jenkins 5 times with constant refreshes, did not see the backtrace or the Evil Jenkins picture. Without the patch, the issue is reproducible every time. Here's the patch I used:

          diff --git a/core/src/main/java/hudson/security/HttpSessionContextIntegrationFilter2.java b/core/src/main/java/hudson/security/HttpSessionContextIntegrationFilter2.java
          index 7a67c77dd0..2084651432 100644
          --- a/core/src/main/java/hudson/security/HttpSessionContextIntegrationFilter2.java
          +++ b/core/src/main/java/hudson/security/HttpSessionContextIntegrationFilter2.java
          @@ -84,7 +84,13 @@ public class HttpSessionContextIntegrationFilter2 extends HttpSessionContextInte
                       return false;
                   }
          .
          -        User userFromSession = User.getById(authentication.getName(), false);
          +        User userFromSession;
          +        try {
          +            userFromSession = User.getById(authentication.getName(), false);
          +        } catch (IllegalStateException e) {
          +            return false;
          +        }
          +
                   if (userFromSession == null) {
                       // no requirement for further test as there is no user inside
                       return false;
          

           

           

          Show
          proski Pavel Roskin added a comment - Yes, I confirm that it works. I patched the code, installed the new jenkins.war, restarted Jenkins 5 times with constant refreshes, did not see the backtrace or the Evil Jenkins picture. Without the patch, the issue is reproducible every time. Here's the patch I used: diff --git a/core/src/main/java/hudson/security/HttpSessionContextIntegrationFilter2.java b/core/src/main/java/hudson/security/HttpSessionContextIntegrationFilter2.java index 7a67c77dd0..2084651432 100644 --- a/core/src/main/java/hudson/security/HttpSessionContextIntegrationFilter2.java +++ b/core/src/main/java/hudson/security/HttpSessionContextIntegrationFilter2.java @@ -84,7 +84,13 @@ public class HttpSessionContextIntegrationFilter2 extends HttpSessionContextInte return false ; } . - User userFromSession = User.getById(authentication.getName(), false ); + User userFromSession; + try { + userFromSession = User.getById(authentication.getName(), false ); + } catch (IllegalStateException e) { + return false ; + } + if (userFromSession == null ) { // no requirement for further test as there is no user inside return false ;    
          Hide
          jthompson Jeff Thompson added a comment -

          Thanks Pavel Roskin. That's what I was thinking of trying. At least you can test that it works. Would you like to submit a PR for that? If you do, be sure to @mention me (@jeffret-b on GitHub).

          I'm looking into an ATH test that is supposed to duplicate this issue but I haven't been able to get it configured correctly yet.

          Show
          jthompson Jeff Thompson added a comment - Thanks Pavel Roskin . That's what I was thinking of trying. At least you can test that it works. Would you like to submit a PR for that? If you do, be sure to @mention me (@jeffret-b on GitHub). I'm looking into an ATH test that is supposed to duplicate this issue but I haven't been able to get it configured correctly yet.
          Hide
          jthompson Jeff Thompson added a comment -

          Inspired by Pavel Roskin's patch, I submitted a PR about this issue: https://github.com/jenkinsci/jenkins/pull/4107

          If anyone affected by this issue would like to review, comment, or especially test that proposal, please do.

          Show
          jthompson Jeff Thompson added a comment - Inspired by Pavel Roskin 's patch, I submitted a PR about this issue:  https://github.com/jenkinsci/jenkins/pull/4107 If anyone affected by this issue would like to review, comment, or especially test that proposal, please do.
          oleg_nenashev Oleg Nenashev made changes -
          Labels regression lts-candidate regression
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          It was fixed in Jenkins 2.185

          Show
          oleg_nenashev Oleg Nenashev added a comment - It was fixed in Jenkins 2.185
          oleg_nenashev Oleg Nenashev made changes -
          Released As Jenkins 2.185
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Fixed but Unreleased [ 10203 ]
          oleg_nenashev Oleg Nenashev made changes -
          Status Fixed but Unreleased [ 10203 ] Resolved [ 5 ]
          Hide
          supjac supjac m added a comment -

          I was getting the same error as the above. But now after the update, I don't get an error, Jenkins just stays on the restarting screen. This is the info from the err.log:

          INFO Restarting VM as requested by user
          INFO jenkins.model.Jenkins$18#onAttained: Started termination
          INFO jenkins.model.Jenkins#_cleanUpDisconnectComputers: Starting node disconnection
          INFO j.s.DefaultJnlpSlaveReceiver#channelClosed: restart thread for Slave1 terminated: java.nio.channels.ClosedChannelException
          INFO j.s.DefaultJnlpSlaveReceiver#channelClosed: restart thread for Slave2 terminated: java.nio.channels.ClosedChannelException
          INFO j.s.DefaultJnlpSlaveReceiver#channelClosed: restart thread for Slave3 terminated: java.nio.channels.ClosedChannelException
          INFO j.s.DefaultJnlpSlaveReceiver#channelClosed: restart thread for Slave4 terminated: java.nio.channels.ClosedChannelException
          INFO jenkins.model.Jenkins#_cleanUpShutdownPluginManager: Stopping plugin manager
          INFO h.p.virtualbox.VirtualBoxPlugin#stop: Stopping VirtualBoxPlugin
          INFO jenkins.model.Jenkins#_cleanUpPersistQueue: Persisting build queue
          INFO jenkins.model.Jenkins#_cleanUpAwaitDisconnects: Waiting for node disconnection completion
          INFO jenkins.model.Jenkins#cleanUp: Jenkins stopped
          WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.
          WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.
          WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.
          WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.
          WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.
          WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.
          WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session

          The warnings will repeat until I restart the service.
          I use Windows server 2012 R2 and Java 8.131
          jenkins username is not an admin for security purposes, but has appropriate permissions.

          Show
          supjac supjac m added a comment - I was getting the same error as the above. But now after the update, I don't get an error, Jenkins just stays on the restarting screen. This is the info from the err.log: INFO Restarting VM as requested by user INFO jenkins.model.Jenkins$18#onAttained: Started termination INFO jenkins.model.Jenkins#_cleanUpDisconnectComputers: Starting node disconnection INFO j.s.DefaultJnlpSlaveReceiver#channelClosed: restart thread for Slave1 terminated: java.nio.channels.ClosedChannelException INFO j.s.DefaultJnlpSlaveReceiver#channelClosed: restart thread for Slave2 terminated: java.nio.channels.ClosedChannelException INFO j.s.DefaultJnlpSlaveReceiver#channelClosed: restart thread for Slave3 terminated: java.nio.channels.ClosedChannelException INFO j.s.DefaultJnlpSlaveReceiver#channelClosed: restart thread for Slave4 terminated: java.nio.channels.ClosedChannelException INFO jenkins.model.Jenkins#_cleanUpShutdownPluginManager: Stopping plugin manager INFO h.p.virtualbox.VirtualBoxPlugin#stop: Stopping VirtualBoxPlugin INFO jenkins.model.Jenkins#_cleanUpPersistQueue: Persisting build queue INFO jenkins.model.Jenkins#_cleanUpAwaitDisconnects: Waiting for node disconnection completion INFO jenkins.model.Jenkins#cleanUp: Jenkins stopped WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session The warnings will repeat until I restart the service. I use Windows server 2012 R2 and Java 8.131 jenkins username is not an admin for security purposes, but has appropriate permissions.
          Hide
          jthompson Jeff Thompson added a comment -

          supjac m, I was afraid the fix would shift the error around somehow. Since Pavel Roskin reported the fix worked for their scenarios, I decided to submit it to see if it helped some people. 

          It's interesting that, in your case at least, that it seems to start immediately after the "Jenkins stopped" message. Maybe there's something going on right at the start of the init sequence. Or maybe even before it somehow.

          Unfortunately, as I've been unable to reproduce the problem I've gone as far as I can with it. If someone else can figure out how to get more information about it or come with a proposal that would be great.

          Show
          jthompson Jeff Thompson added a comment - supjac m , I was afraid the fix would shift the error around somehow. Since Pavel Roskin reported the fix worked for their scenarios, I decided to submit it to see if it helped some people.  It's interesting that, in your case at least, that it seems to start immediately after the "Jenkins stopped" message. Maybe there's something going on right at the start of the init sequence. Or maybe even before it somehow. Unfortunately, as I've been unable to reproduce the problem I've gone as far as I can with it. If someone else can figure out how to get more information about it or come with a proposal that would be great.
          Hide
          gzanella Guilherme Emiliano Zanella added a comment - - edited

          I'm still with the same problem. I try to configure the artifactory and when I restart the jenkins after install or uninstall the artifactory plugin i got this error:

           

          "

          Stack trace

          java.lang.IllegalStateException: Expected 1 instance of hudson.model.User$AllUsers but got 0 at hudson.ExtensionList.lookupSingleton(ExtensionList.java:451) at hudson.model.User$AllUsers.getInstance(User.java:1080) at hudson.model.User$AllUsers.get(User.java:1098) at hudson.model.User$AllUsers.access$100(User.java:1061) at hudson.model.User.getOrCreateById(User.java:517) at hudson.model.User.getById(User.java:615) 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:1610) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540) 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:1701) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1668) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) 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:502) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267) 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:117) 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)

          "

          Show
          gzanella Guilherme Emiliano Zanella added a comment - - edited I'm still with the same problem. I try to configure the artifactory and when I restart the jenkins after install or uninstall the artifactory plugin i got this error:   " Stack trace java.lang.IllegalStateException: Expected 1 instance of hudson.model.User$AllUsers but got 0 at hudson.ExtensionList.lookupSingleton(ExtensionList.java:451) at hudson.model.User$AllUsers.getInstance(User.java:1080) at hudson.model.User$AllUsers.get(User.java:1098) at hudson.model.User$AllUsers.access$100(User.java:1061) at hudson.model.User.getOrCreateById(User.java:517) at hudson.model.User.getById(User.java:615) 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:1610) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540) 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:1701) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1668) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) 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:502) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267) 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:117) 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) "
          Hide
          jthompson Jeff Thompson added a comment -

          Guilherme Emiliano Zanella, double-check your versions and make sure you've got the version of Jenkins that contains the change. The line numbers of your stack trace don't line up with changed version.

          Show
          jthompson Jeff Thompson added a comment - Guilherme Emiliano Zanella , double-check your versions and make sure you've got the version of Jenkins that contains the change. The line numbers of your stack trace don't line up with changed version.
          Hide
          gzanella Guilherme Emiliano Zanella added a comment -

          Jeff Thompson, I did "sudo apt-get upgrade jenkins" and after the upgrade i try to uninstall and install again and got the same error.

          "

          Stack trace

          java.lang.IllegalStateException: Expected 1 instance of hudson.model.User$AllUsers but got 0 at hudson.ExtensionList.lookupSingleton(ExtensionList.java:451) at hudson.model.User$AllUsers.getInstance(User.java:1080) at hudson.model.User$AllUsers.get(User.java:1098) at hudson.model.User$AllUsers.access$100(User.java:1061) at hudson.model.User.getOrCreateById(User.java:517) at hudson.model.User.getById(User.java:615) 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:1610) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540) 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:1701) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1668) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) 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:502) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267) 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:117) 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)

          "

          Sorry but I still beginning with this tool and doesn't know much, what I do to fix this? Please..

          Show
          gzanella Guilherme Emiliano Zanella added a comment - Jeff Thompson, I did "sudo apt-get upgrade jenkins" and after the upgrade i try to uninstall and install again and got the same error. " Stack trace java.lang.IllegalStateException: Expected 1 instance of hudson.model.User$AllUsers but got 0 at hudson.ExtensionList.lookupSingleton(ExtensionList.java:451) at hudson.model.User$AllUsers.getInstance(User.java:1080) at hudson.model.User$AllUsers.get(User.java:1098) at hudson.model.User$AllUsers.access$100(User.java:1061) at hudson.model.User.getOrCreateById(User.java:517) at hudson.model.User.getById(User.java:615) 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:1610) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540) 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:1701) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1668) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) 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:502) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267) 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:117) 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) " Sorry but I still beginning with this tool and doesn't know much, what I do to fix this? Please..
          Hide
          jthompson Jeff Thompson added a comment -

          Guilherme Emiliano Zanella, I'm not sure what version that will give you. When you run Jenkins, which version does it say you have?

          Show
          jthompson Jeff Thompson added a comment - Guilherme Emiliano Zanella , I'm not sure what version that will give you. When you run Jenkins, which version does it say you have?
          gzanella Guilherme Emiliano Zanella made changes -
          gzanella Guilherme Emiliano Zanella made changes -
          Hide
          gzanella Guilherme Emiliano Zanella added a comment -

          Jeff Thompson

          Says I have the Jenkins 2.176.2.

          About Jenkins 2.176.2 [Jenkins].pdf

          Show
          gzanella Guilherme Emiliano Zanella added a comment - Jeff Thompson Says I have the Jenkins 2.176.2. About Jenkins 2.176.2 [Jenkins].pdf
          Hide
          jthompson Jeff Thompson added a comment -

          That explains your observations, Guilherme Emiliano Zanella. The change went into the 2.185 weekly release. You've got the latest LTS release, which doesn't have this change. You could request this change be backported to the next incremental release of the LTS. I would be hesitant to backport this, given its experimental nature and we have a report of the change not fixing things for someone. You could switch from using the LTS line to the weekly. See [LTS Release Line](https://jenkins.io/download/lts/) for more information.

          Show
          jthompson Jeff Thompson added a comment - That explains your observations, Guilherme Emiliano Zanella . The change went into the 2.185 weekly release. You've got the latest LTS release, which doesn't have this change. You could request this change be backported to the next incremental release of the LTS. I would be hesitant to backport this, given its experimental nature and we have a report of the change not fixing things for someone. You could switch from using the LTS line to the weekly. See [LTS Release Line] ( https://jenkins.io/download/lts/ ) for more information.
          Hide
          gzanella Guilherme Emiliano Zanella added a comment -

          I do this and the error has gone. Thank you for help!

          Show
          gzanella Guilherme Emiliano Zanella added a comment - I do this and the error has gone. Thank you for help!
          Hide
          supjac supjac m added a comment -

          so, I have fixed the issue with my jenkins setup.
          After looking into the WindowsServiceLifecycle, i noticed that the command to restart was restart! When I tried that in the command line I got my actual error:
          Unhandled Exception: System.IO.FileLoadException: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
          So jenkins was not actually restarting, just getting through the cleanup phase
          I installed .net 3.5 but was still getting the same error. I had to modify my Jenkins.exe.config to look like this:
          <startup>
          <startup useLegacyV2RuntimeActivationPolicy="true">
          <supportedRuntime version="v4.0" />
          </startup>

          Now it is working for me

          Show
          supjac supjac m added a comment - so, I have fixed the issue with my jenkins setup. After looking into the WindowsServiceLifecycle, i noticed that the command to restart was restart! When I tried that in the command line I got my actual error: Unhandled Exception: System.IO.FileLoadException: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. So jenkins was not actually restarting, just getting through the cleanup phase I installed .net 3.5 but was still getting the same error. I had to modify my Jenkins.exe.config to look like this: <startup> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" /> </startup> Now it is working for me
          Hide
          simontunnat Simon Tunnat added a comment -

          I have the same problem with Jenkins LTS 2.176.2. Could you please fix that version as well?

          Show
          simontunnat Simon Tunnat added a comment - I have the same problem with Jenkins LTS 2.176.2. Could you please fix that version as well?
          Hide
          jthompson Jeff Thompson added a comment -

          Simon Tunnat, you are welcome to request this change be backported. Since supjac m, determined their continued failures were unrelated I no longer object to backporting.

          Show
          jthompson Jeff Thompson added a comment - Simon Tunnat , you are welcome to request this change be backported. Since supjac m , determined their continued failures were unrelated I no longer object to backporting.
          Hide
          simontunnat Simon Tunnat added a comment -

          Jeff Thompson how / where do I have to request such a backport?

          Show
          simontunnat Simon Tunnat added a comment - Jeff Thompson how / where do I have to request such a backport?
          Hide
          jthompson Jeff Thompson added a comment -

          Simon Tunnat, as I mentioned above, you can read about the LTS releases, including backports, at https://jenkins.io/download/lts/

          Show
          jthompson Jeff Thompson added a comment - Simon Tunnat , as I mentioned above, you can read about the LTS releases, including backports, at  https://jenkins.io/download/lts/
          olivergondza Oliver Gondža made changes -
          Labels lts-candidate regression 2.176.3-fixed regression
          Hide
          luebbe Lübbe Onken added a comment - - edited

          The issue is not yet resolved.

          We have exactly the same problem as supjac m in #comment-371811.

          Just updated Jenkins from 2.219 to 2.220, Windows Server 2016 and a dedicated jenkins user.

          Jenkins gets into this infinite loop when we try to restart it from the web frontend.
          The jenkins service always has to be restarted manually after a jenkins or plugin update.

          No problems restarting jenkins from the web frontend when it runs as system user directly after the installation.

           

          2020-02-11 10:38:05.853+0000 [id=770] INFO jenkins.model.Jenkins#cleanUp: Stopping Jenkins
          2020-02-11 10:38:05.868+0000 [id=770] INFO jenkins.model.Jenkins$18#onAttained: Started termination
          2020-02-11 10:38:05.946+0000 [id=770] INFO jenkins.model.Jenkins$18#onAttained: Completed termination
          2020-02-11 10:38:05.946+0000 [id=770] INFO jenkins.model.Jenkins#_cleanUpDisconnectComputers: Starting node disconnection
          2020-02-11 10:38:05.962+0000 [id=770] INFO jenkins.model.Jenkins#_cleanUpShutdownPluginManager: Stopping plugin manager
          2020-02-11 10:38:05.962+0000 [id=770] INFO jenkins.model.Jenkins#_cleanUpPersistQueue: Persisting build queue
          2020-02-11 10:38:05.979+0000 [id=770] INFO jenkins.model.Jenkins#_cleanUpAwaitDisconnects: Waiting for node disconnection completion
          2020-02-11 10:38:05.979+0000 [id=770] INFO jenkins.model.Jenkins#cleanUp: Jenkins stopped
          2020-02-11 10:38:06.103+0000 [id=12] WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.
          2020-02-11 10:38:11.133+0000 [id=603] WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.
          2020-02-11 10:38:16.164+0000 [id=632] WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.
          2020-02-11 10:38:21.193+0000 [id=12] WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.
          2020-02-11 10:38:26.211+0000 [id=603] WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.

          Show
          luebbe Lübbe Onken added a comment - - edited The issue is not yet resolved. We have exactly the same problem as supjac m in #comment-371811. Just updated Jenkins from 2.219 to 2.220, Windows Server 2016 and a dedicated jenkins user. Jenkins gets into this infinite loop when we try to restart it from the web frontend. The jenkins service always has to be restarted manually after a jenkins or plugin update. No problems restarting jenkins from the web frontend when it runs as system user directly after the installation.   2020-02-11 10:38:05.853+0000 [id=770] INFO jenkins.model.Jenkins#cleanUp: Stopping Jenkins 2020-02-11 10:38:05.868+0000 [id=770] INFO jenkins.model.Jenkins$18#onAttained: Started termination 2020-02-11 10:38:05.946+0000 [id=770] INFO jenkins.model.Jenkins$18#onAttained: Completed termination 2020-02-11 10:38:05.946+0000 [id=770] INFO jenkins.model.Jenkins#_cleanUpDisconnectComputers: Starting node disconnection 2020-02-11 10:38:05.962+0000 [id=770] INFO jenkins.model.Jenkins#_cleanUpShutdownPluginManager: Stopping plugin manager 2020-02-11 10:38:05.962+0000 [id=770] INFO jenkins.model.Jenkins#_cleanUpPersistQueue: Persisting build queue 2020-02-11 10:38:05.979+0000 [id=770] INFO jenkins.model.Jenkins#_cleanUpAwaitDisconnects: Waiting for node disconnection completion 2020-02-11 10:38:05.979+0000 [id=770] INFO jenkins.model.Jenkins#cleanUp: Jenkins stopped 2020-02-11 10:38:06.103+0000 [id=12] WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. 2020-02-11 10:38:11.133+0000 [id=603] WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. 2020-02-11 10:38:16.164+0000 [id=632] WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. 2020-02-11 10:38:21.193+0000 [id=12] WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. 2020-02-11 10:38:26.211+0000 [id=603] WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.
          nkjensen Niels Kristian Jensen made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] In Review [ 10005 ]
          Hide
          nkjensen Niels Kristian Jensen added a comment -

          Lübbe Onken is right - we have the same issue where jenkins.err.log shows:

          Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.

          We use Jenkins 2.255 on Windows Server 2016

          Show
          nkjensen Niels Kristian Jensen added a comment - Lübbe Onken is right - we have the same issue where jenkins.err.log shows: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. We use Jenkins 2.255 on Windows Server 2016
          Hide
          ethorsa ethorsa added a comment -

          I can confirm the problem on windows hosted Jenkins v2.235.5.

          Show
          ethorsa ethorsa added a comment - I can confirm the problem on windows hosted Jenkins v2.235.5.
          Hide
          nkjensen Niels Kristian Jensen added a comment - - edited

          The issue is still there in Jenkins 2.249.1 on Windows Server 2019 and a dedicated jenkins user.

          Show
          nkjensen Niels Kristian Jensen added a comment - - edited The issue is still there in Jenkins 2.249.1 on Windows Server 2019 and a dedicated jenkins user.
          Hide
          altxt Alex added a comment -

          I got the same flood of errors on Jenkins 2.263.1

          WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session.
          

          Took a look at jenkins.wrapper.log and noticed

          2021-01-11 00:37:42,243 FATAL - WMI Operation failure: AccessDenied
          WMI.WmiException: AccessDenied
             at WMI.WmiRoot.BaseHandler.CheckError(ManagementBaseObject result)
             at WMI.WmiRoot.InstanceHandler.Invoke(Object proxy, MethodInfo method, Object[] arguments)
             at winsw.WrapperService.<Run>g__Restart|33_5(<>c__DisplayClass33_0& )
             at winsw.WrapperService.Run(String[] _args, ServiceDescriptor descriptor)
             at winsw.WrapperService.Main(String[] args)
          

          So it looks like the Web UI /restart endpoint is trying to actually restart a Windows service, for which it does not have permissions if running as a limited user. To fix this, it is possible to run Jenkins as a member of Power Users or Administrators group, but I chose to grant permissions for restarting only the Jenkins service.

          Using setacl, to view permissions:
          SetACL.exe -on jenkins -ot srv -actn list
          To grant service restart permissions ('jenkins' is the name of the service and 'domain\user' should be replaced with actual values):
          SetACL.exe -on jenkins -ot srv -actn ace -ace "n:domain\user;p:start_stop;m:grant"

          Tried it, and it worked for me.

          Show
          altxt Alex added a comment - I got the same flood of errors on Jenkins 2.263.1 WARNING h.s.HttpSessionContextIntegrationFilter2#hasInvalidSessionSeed: Encountered IllegalStateException trying to get a user. System init may not have completed yet. Invalidating user session. Took a look at jenkins.wrapper.log and noticed 2021-01-11 00:37:42,243 FATAL - WMI Operation failure: AccessDenied WMI.WmiException: AccessDenied at WMI.WmiRoot.BaseHandler.CheckError(ManagementBaseObject result) at WMI.WmiRoot.InstanceHandler.Invoke(Object proxy, MethodInfo method, Object[] arguments) at winsw.WrapperService.<Run>g__Restart|33_5(<>c__DisplayClass33_0& ) at winsw.WrapperService.Run(String[] _args, ServiceDescriptor descriptor) at winsw.WrapperService.Main(String[] args) So it looks like the Web UI /restart endpoint is trying to actually restart a Windows service, for which it does not have permissions if running as a limited user. To fix this, it is possible to run Jenkins as a member of Power Users or Administrators group, but I chose to grant permissions for restarting only the Jenkins service. Using setacl , to view permissions: SetACL.exe -on jenkins -ot srv -actn list To grant service restart permissions ('jenkins' is the name of the service and 'domain\user' should be replaced with actual values): SetACL.exe -on jenkins -ot srv -actn ace -ace "n:domain\user;p:start_stop;m:grant" Tried it, and it worked for me.
          Show
          nkjensen Niels Kristian Jensen added a comment - We no longer have the issue, after applying the fix seen here: https://issues.jenkins.io/browse/JENKINS-50219?focusedCommentId=338697&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-338697
          Hide
          ethorsa ethorsa added a comment -

          Niels Kristian Jensen unfortunately this didn't help in my case, I still get an IllegalStateException and stuck Jenkins.

          Show
          ethorsa ethorsa added a comment - Niels Kristian Jensen  unfortunately this didn't help in my case, I still get an IllegalStateException and stuck Jenkins.
          Hide
          douglasawh Doug Whitfield added a comment -

          Lots of discussion about this on Windows. Are people seeing this on Linux?

          Also, below is our exact error. It has the same Expected instance syntax, but it isn't referencing the AllUsers, so I wonder if this is something different.

          java.lang.IllegalStateException: Expected 1 instance of jenkins.security.s2m.AdminWhitelistRule but got 0
          at hudson.ExtensionList.lookupSingleton(ExtensionList.java:451)
          at io.jenkins.plugins.casc.core.AdminWhitelistRuleConfigurator.instance(AdminWhitelistRuleConfigurator.java:59)
          at io.jenkins.plugins.casc.core.AdminWhitelistRuleConfigurator.instance(AdminWhitelistRuleConfigurator.java:42)
          at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:286)
          at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:351)
          at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:287)
          at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$8(ConfigurationAsCode.java:777)
          at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:713)
          at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:777)
          at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:762)
          at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:638)
          at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:307)
          at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:299)
          Show
          douglasawh Doug Whitfield added a comment - Lots of discussion about this on Windows. Are people seeing this on Linux? Also, below is our exact error. It has the same Expected instance syntax, but it isn't referencing the AllUsers, so I wonder if this is something different. java.lang.IllegalStateException: Expected 1 instance of jenkins.security.s2m.AdminWhitelistRule but got 0 at hudson.ExtensionList.lookupSingleton(ExtensionList.java:451) at io.jenkins.plugins.casc.core.AdminWhitelistRuleConfigurator.instance(AdminWhitelistRuleConfigurator.java:59) at io.jenkins.plugins.casc.core.AdminWhitelistRuleConfigurator.instance(AdminWhitelistRuleConfigurator.java:42) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:286) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:351) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:287) at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$8(ConfigurationAsCode.java:777) at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:713) at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:777) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:762) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:638) at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:307) at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:299)

            People

            Assignee:
            jthompson Jeff Thompson
            Reporter:
            artem_fedorov Artem Fedorov
            Votes:
            16 Vote for this issue
            Watchers:
            29 Start watching this issue

              Dates

              Created:
              Updated: