- Notifications
You must be signed in to change notification settings - Fork116
JENKINS-76298 - Add default value cache to AbstractScriptableParameter#591
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
kinow commentedNov 21, 2025
Sounds like a good improvement,@Jendoliver ! Haven't looked at the code yet, but the explanation is very clear, thanks. Will try to review over next days (I'll be offline next week working on a personal project, so I should have some spare time 👍 ). Thanks |
kinow left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Just had a look a the code, and was surprised by how small your change was! Great job for spotting where that can be done.
I'm curious whether it will break any existing scripts (cc@imoutsatsos). I will try a few examples, and see if I can add a test (if you can add a test it'll be faster to review/merge if it works).
Thanks again!
Jendoliver commentedNov 21, 2025
Thanks so much for the review@kinow! Will have a look into adding that test myself to speed things up 👍 |
f5b8643 tob164803Compare
Uh oh!
There was an error while loading.Please reload this page.
This is a tentative fix forhttps://issues.jenkins.io/browse/JENKINS-76298
In a nutshell, builds that start without parameter values call
AbstractScriptableParameter#getDefaultParameterValuefor everyAbstractScriptableParameterin the job parameters once per everyparamsread, which causes the same script to be executed over and over just to render the same value. In my case this is making first builds of multibranch pipeline jobs extremely slow once users push their new branches, as that build starts without parameters and my pipeline does a lot ofparamsaccess at the first stage, which triggers this situation.Testing done
You can reproduce the problem and validate my fix by following these steps:
staticMethod java.lang.Thread sleep longsignature or else the scripts won't actually be running.paramsis retriggering all the scripts in series while calculating the default value.staticMethod java.lang.Thread sleep longsignature again if you restart Jenkins and don't have that persisted.paramswill calculate all the default values, but further accesses will use the cached values.Here's a screenshot before/after (middle hidden build is where I needed to accept the signature again):

Submitter checklist