-
Bug
-
Resolution: Fixed
-
Blocker
-
active-choices 1.5, Jenkins 2.19.2, Windows Server 2008 R2
-
Powered by SuggestiMate
After upgrading to the Active Choices v1.5 jobs originally containing Active Choices v1.4 definitions load and work fine. However, if the configuration of one of these jobs now gets saved (you don't even need to modify it) all parameters to scriptlets used in Active Choices are dropped and the form UI does not render.
See attached screenshot on the parameter definition changes before and after the configuration is changed.
- duplicates
-
JENKINS-39760 Active Choices Parameters lost of Job Config save
-
- Closed
-
- is related to
-
JENKINS-39534 When Jenkins restarts, the groovy scripts are lost
-
- Closed
-
[JENKINS-39620] Saving a job with Active Choice 1.4 parameters after upgrade to v1.5 resets scriptlet parameters
Oh! Fixing a FindBugs warning that was preventing the last release, I marked the secureScript and fallbackSecureScript, both as "transient".
So these fields were not being persisted after you restarted Jenkins.
I believe I know how to fix it, and once I've tested it, will cut a new release.
Sorry for the trouble.
Code changed in jenkins
User: Bruno P. Kinoshita
Path:
src/findbugs/excludesFilter.xml
src/main/java/org/biouno/unochoice/model/GroovyScript.java
http://jenkins-ci.org/commit/active-choices-plugin/cac73ce953ce6419e14ad2ad7a12b0982fb8652b
Log:
[FIXED JENKINS-39620] and JENKINS-39534 Revert change that marked fields as transient, and add FindBugs exclusion filters
Code changed in jenkins
User: Bruno P. Kinoshita
Path:
src/findbugs/excludesFilter.xml
src/main/java/org/biouno/unochoice/model/GroovyScript.java
http://jenkins-ci.org/commit/active-choices-plugin/44c21fc6bab67a538d785712d2a3aa302d20ea1a
Log:
[FIXED JENKINS-39620] and JENKINS-39534 Revert change that marked fields as transient, and add FindBugs exclusion filters
Thanks Bruno! Good catch!
I will give this hpi a try first thing this morning at work. In my case, the parameter persistence issue did not require a Jenkins restart to manifest. As soon as the configuration was 'applied' or 'saved' the parameters were lost.
Holy crap, this bug just wiped all of our parameters for all our jobs on our jenkins instance using this plugin. I ran a planned "bulk update and save" of all our job configs and now everything is gone.
The UI also displays the words "ParametersDescription" instead of "Parameters" like it did in 1.4.
I'm at a loss for words. This will keep me up through the night! haha! 1.5 is not usable. It should be removed completely from the plugins download list.
Thank you for the great plugin though! Aside from this disaster, it has helped us tremendously otherwise. Any idea how long the wait would be for 1.6 ? Or is rolling back to 1.4 my best bet?
Unfortunately the issue persists with the hpi (Active Choices v 1.5.1) attached here. Can we remove this version form the update site until we have some more testing done?
Thank You kinow!!
Hi wynandvw,
>Holy crap, this bug just wiped all of our parameters for all our jobs on our jenkins instance using this plugin. I ran a planned "bulk update and save" of all our job configs and now everything is gone.
Sorry for the trouble it caused to your installation.
>I'm at a loss for words. This will keep me up through the night! haha! 1.5 is not usable. It should be removed completely from the plugins download list.
Done. Should be removed in the next hours.
https://github.com/jenkinsci/backend-update-center2/pull/90
>Thank you for the great plugin though! Aside from this disaster, it has helped us tremendously otherwise. Any idea how long the wait would be for 1.6 ? Or is rolling back to 1.4 my best bet?
We are testing possible fixes. If you have the time to help us testing it that would be great. We have unit tests, and a test bed server, but unfortunately we missed this bug.
Should be fixed in 1.5.1, released moments ago. 1.5.0 was removed.
Blog about that here: http://biouno.org/2016/11/11/what-happens-when-you-make-a-java-member-variable-transient-in-a-jenkins-plugin
Hi Bruno,
We just upgraded our plugin to 1.5.1 (from 1.3) on our TEST server and have experienced this exact issue. We tried downgrading/upgrading and manually installing the hpi... neither worked. Is the hpi available on the download server definitely the correct one?
Thanks!
Paul
Hi Paul,
>We just upgraded our plugin to 1.5.1 (from 1.3) on our TEST server and have experienced this exact issue
It's great to have another test server to experiment with changes. Could you run some tests with alpha/beta versions?
>Is the hpi available on the download server definitely the correct one?
Just downloaded the 1.5.1 hpi, and decompiled with jad. The fields are definitely not transient. However, while looking at the decompiled code, I noticed the serialVersionUID was not updated.
So I've update the serialversionUID locally. Could you give it a go in your local test environment, please? I'm attaching the hpi with this change:
~/Development/java/workspace/active-choices-plugin$ git diff diff --git a/src/main/java/org/biouno/unochoice/model/GroovyScript.java b/src/main/java/org/biouno/unochoice/model/GroovyScript.java index d74d9ab..2b828b3 100644 --- a/src/main/java/org/biouno/unochoice/model/GroovyScript.java +++ b/src/main/java/org/biouno/unochoice/model/GroovyScript.java @@ -53,7 +53,7 @@ public class GroovyScript extends AbstractScript { /* * Serial UID. */ - private static final long serialVersionUID = -4886250205110550815L; + private static final long serialVersionUID = -3741105849416473898L; private static final Logger LOGGER = Logger.getLogger(GroovyScript.class.getName())
Hi Bruno,
That hpi yielded the same result. Steps I took:
- Installed fresh copy of Jenkins locally
- Installed Active Choices plugin v1.5.1 (from central plugin repo)
- Created empty scriptler script to use with choices parameter
- Created new job, added 'Active Choices Reactive Reference Parameter' with 'Scriptler Script' option
- Added script parameter: Name: "p1", Value: "v1"
- Saved
- Re-open configuration and observe issue (my "p1" parameter is gone)
I then installed the hpi you attached (v1.5.2). I uninstalled 1.5.1 and manually deleted the files from the plugins folder as well. Then manually uploaded v1.5.2 and tested again. Same result.
Thoughts?
Thanks for testing it out Paul.
I've successfully reproduced the issue this time. I was paying attention to the transient issue we had recently, but wasn't specifically looking at scriptler parameters.
Besides adding script-security-plugin, we have also upgraded dependencies - including scriptler-plugin. Scriptler Plugin API changed, and one part of the changes broke the UI. I have it working locally, and it's persisting the values. But I'm getting a different - and strange - error when the script is evaluated.
Nov 16, 2016 11:26:33 AM org.biouno.unochoice.AbstractScriptableParameter eval SEVERE: Error executing script for dynamic parameter java.lang.RuntimeException: Failed to evaluate script: No signature of method: Script1.$() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@4d74e7af] Possible solutions: is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure), use([Ljava.lang.Object;) at org.biouno.unochoice.model.GroovyScript.eval(GroovyScript.java:182) at org.biouno.unochoice.model.ScriptlerScript.eval(ScriptlerScript.java:115) at org.biouno.unochoice.util.ScriptCallback.call(ScriptCallback.java:96) at org.biouno.unochoice.AbstractScriptableParameter.eval(AbstractScriptableParameter.java:233) at org.biouno.unochoice.AbstractScriptableParameter.getChoices(AbstractScriptableParameter.java:196) at org.biouno.unochoice.AbstractCascadableParameter.getChoicesForUI(AbstractCascadableParameter.java:137) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:320) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:163) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96) at org.kohsuke.stapler.MetaClass$JavaScriptProxyMethodDispatcher.doDispatch(MetaClass.java:474) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.MetaClass$11.dispatch(MetaClass.java:380) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:813) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649) at org.kohsuke.stapler.Stapler.service(Stapler.java:199) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:745) Caused by: groovy.lang.MissingMethodException: No signature of method: Script1.$() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@4d74e7af] Possible solutions: is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure), use([Ljava.lang.Object;) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) at Script1.run(Script1.groovy:1) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:168) at org.biouno.unochoice.model.GroovyScript.eval(GroovyScript.java:170) ... 60 more
So I'm currently debugging this issue, that happens only for Scriptler scripts. Groovy scripts work fine.
All right, just a typo in my Scriptler script
Attaching a new version. Could you give it a try again Paul, please?
Note: the latest attached hpi was built from the code that is currently in the master branch. In case it is confirmed this fixes this issue, we can release 1.5.2 straight away
Hi Bruno,
Success! I tried it locally (as I don't have access to install plugins on our TEST server) and it worked. I'll confirm tomorrow that it works in our TEST environment but my bet is that it will.
Thanks!
Paul
Excellent! Great news Paul.
Once you confirm it worked on your test environment, I'll push the new version to the update center.
Cheers
Bruno
Hi again Paul, there was a duplicate issue posted. So I'm tempted to release 1.5.2 tonight (it's 2 PM my time now) with this fix.
What do you think?
Active Choices v1.5.2 works for me too! Thanks kinow! Well done!!
At least related, if not duplicated.