Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover views after error in Jenkins.load #10023

Merged
merged 5 commits into from
Dec 12, 2024
Merged

Conversation

jglick
Copy link
Member

@jglick jglick commented Dec 3, 2024

I had occasionally seen mysterious errors in CloudBees CI which I finally tracked down by observing that they came after a warning about reloading $JENKINS_HOME/config.xml from disk. #8413 made this somewhat safer but not enough.

(CloudBees-internal reference)

Testing done

Without the fix, the assertions about .primaryView and .views fail. More interestingly, while browsing the dashboard (goTo("")) simply fails with a 404 (Stapler trace is pretty obvious: looking up the primary view fails since it is null), browsing some other pages produces two StackOverflowErrors from Stapler/Jelly:

…
	at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:98)
	at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:174)
	at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:271)
	at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:98)
…

and

…
	at org.apache.commons.jelly.JellyContext.getVariableWithDefaultValue(JellyContext.java:260)
	at org.apache.commons.jelly.JellyContext.getVariableWithDefaultValue(JellyContext.java:260)
…

which seems to be caused by an unfortunate default logic in IncludeTag resulting in an infinite recursion when it=null.

Proposed changelog entries

  • Restore the list of views after a failed attempt to reload global configuration, to avoid further rendering errors.

Proposed upgrade guidelines

N/A

Desired reviewers

@Vlatombe

Before the changes are marked as ready-for-merge:

Maintainer checklist

Preview Give feedback

@jglick jglick requested a review from Vlatombe December 3, 2024 22:42
Copy link
Member

@dwnusbaum dwnusbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, there was a similar issue with views in folders caused by HashiCorp Vault plugin, fixed by jenkinsci/hashicorp-vault-plugin#336 and made more robust in core by #9653, leading to the same recursion as in jenkinsci/cloudbees-folder-plugin#447.

Do you have an OldDataMonitor warning for an observed loading failure? I wonder if any other XStream robustness improvements are possible here.

@jglick
Copy link
Member Author

jglick commented Dec 4, 2024

Do you have an OldDataMonitor warning for an observed loading failure?

No, OldDataMonitor is only triggered when XStream unmarshalling completed with some recoverable issues of known categories, like missing fields. The situation here is not necessarily about XStream; I used invalid XML for the test case but I think I saw the bug in response to some transient IOException loading config.xml.

@timja
Copy link
Member

timja commented Dec 11, 2024

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Dec 11, 2024
@timja timja merged commit 4943f16 into jenkinsci:master Dec 12, 2024
16 checks passed
@jglick jglick deleted the Jenkins.load branch December 13, 2024 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants