I recently upgraded Jenkins from 2.204.4 to 2.332.1. In doing so, I received the following error.
java.lang.IllegalStateException: An attempt to save the global configuration was made before it was loaded
at jenkins.model.Jenkins.save(Jenkins.java:3519)
at jenkins.model.Jenkins.saveQuietly(Jenkins.java:3546)
at jenkins.model.Jenkins.setSecurityRealm(Jenkins.java:2743)
at jenkins.model.Jenkins$15.run(Jenkins.java:3481)
at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:175)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
at jenkins.model.Jenkins$5.runTask(Jenkins.java:1156)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:222)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:121)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused: org.jvnet.hudson.reactor.ReactorException
at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:291)
at jenkins.InitReactorRunner.run(InitReactorRunner.java:49)
at jenkins.model.Jenkins.executeReactor(Jenkins.java:1191)
at jenkins.model.Jenkins.<init>(Jenkins.java:981)
at hudson.model.Hudson.<init>(Hudson.java:86)
at hudson.model.Hudson.<init>(Hudson.java:82)
at hudson.WebAppMain$3.run(WebAppMain.java:247)
Caused: hudson.util.HudsonFailedToLoad
at hudson.WebAppMain$3.run(WebAppMain.java:264)
I was able to "fix" this by commenting out the and blocks in config.xml, but that had the side effect of wiping out our Active Directory settings as well as all Role Based permissions.
I saved the settings, so I was able to manually set everything back up, but now after a Jenkins reboot, I get the same error.
I noticed in the Jenkins error log it is throwing the following error for all users on startup
SEVERE hudson.model.User#loadFromUserConfigFile: Failed to load E:\jenkins\users\{user}\config.xml
java.nio.channels.ClosedByInterruptException
I am rather new to Jenkins, so I am not sure what would be causing this. Has anyone encountered this or know of a fix?
Edit: As mentioned in my comment I discovered the error is due to the role-strategy plugin. I attempted to use the Configuration as Code plugin, thinking that this would load the config.xml settings at the correct time, but that is not the case.
The issue is that there is still info in <authorizationStrategy>
block in config.xml when Jenkins restarts... is there a way to clear that?