2

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?

1
  • Upon further investigation today, I enabled Active Directory but changed the Authorization Strategy to "Anyone can do Anything" and attempted a restart. I did not receive the error, therefore I suppose the issue would be coming from the role-strategy-plugin...
    – jander69
    Apr 7 at 14:49

2 Answers 2

1

After much investigation, I came across the fact that some plugins, specifically the Matrix Authorization Strategy Plugin and role-strategy-plugin were in a deadlock state where they both would not be checked under "compatible" to update, as they were dependent on each other being updated.

Being fairly knew to Jenkins, and not wanting to break things, I only updated the compatible plugins, however; I missed this deadlock type issue.

Updating both of these plugins fixed the issue.

1
  • 1
    Thanks for sharing this answer to your own question. Make sure to mark it accepted also (after the system allows you to do so (I think as of tomorrow).
    – Pierre.Vriens
    Apr 7 at 20:33
1

Adding to @jander69 research,

I performed the below steps and it worked:

  1. Stop the jenkins server using jenkins.exe stop command.

  2. In the jenkins installation folder, open Plugins folder and delete below listed plugins and their .jpi files.

    i. role-strategy folder and role-strategy.jpi

    ii. matrix-auth folder and matrix-auth.jpi

  3. In the same jenkins installation folder, open config.xml file in any editor.

  4. Delete the section with tag <authorizationStrategy> ... </authorizationStrategy> and save config.xml file.

  5. Start the jenkins server using jenkins.exe start command.

Now, Jenkins should load as expected without the IllegalStateException: An attempt to save the global configuration was made before it was loaded error.

1
  • Thank you for adding to this, that will go one step farther by removing the plugins themselves as well. Still not an actual "solution" as it leaves you without your roles, but at least it gives you a place to work from rather than an error screen...
    – jander69
    Jun 6 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.