-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
nothing special
Setup:
Jenkins 1.530
Job1 triggers Job2 on completion
Job2 requires a run parameter of project "Job1"
Bug (root cause):
When an upstream job triggers a downstream job with a run parameter (last successful) of the upstream job, the default does not work correctly. Since the trigger happens before the upstream job is technically complete, the last successful job is actually the one before. Annoying, but easy to work around by manually adding the run parameter to the upstream job or using curl to determine the latest build and using an appropriate delay.
Consequence of bug:
When all the old builds are discarded due to aggressive log rotation rules (or not running the build for a while), there is a timing condition that will produce this stack trace:
Started by upstream project "FullBuild" build number 356
originally caused by:
Started by upstream project "IncrementalBuild" build number 422
originally caused by:
Started by an SCM change
Building remotely on jenkins1 in workspace /home/jenkins/workspace/Devtest
No emails were triggered.
FATAL: null
java.lang.NullPointerException
at hudson.model.RunParameterValue.buildEnvVars(RunParameterValue.java:74)
at hudson.model.ParametersAction.buildEnvVars(ParametersAction.java:83)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:923)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:84)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:60)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:567)
at hudson.model.Run.execute(Run.java:1603)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:246)
- is related to
-
JENKINS-20989 PeepholePermalink RunListenerImpl oncompleted should be triggered before downstream builds are triggered
-
- Resolved
-
Finally got the exception reproduced in a more simple configuration. config.xml files attached shortly...
When there is no crash, you will notice that the UNSET_RUNPARAM is always wrong and sometimes even unset. RUNPARAM, however, is set correct, but doesn't have the extra sub-settings that go along with it like UNSET_RUNPARAM_RESULT or UNSET_RUNPARAM.number=20.
To reproduce the exception, the two jobs - ParamTest1 and ParamTest2 need to be run a dozen times or so each day. The first run of the day has a chance of triggering this bug (the "consequence" as described above). It took me about 5 days to reproduce it (although usually I only ran about 3 jobs in a day, not a dozen). Entire output is:
Started by upstream project "ParamTest1" build number 20
originally caused by:
Started by user Duane Bronson
Building remotely on cascade-jenkins1 in workspace /home/jenkins/workspace/ParamTest2
FATAL: null
java.lang.NullPointerException
at hudson.model.RunParameterValue.buildEnvVars(RunParameterValue.java:74)
at hudson.model.ParametersAction.buildEnvVars(ParametersAction.java:83)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:923)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:776)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1408)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:657)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:562)
at hudson.model.Run.execute(Run.java:1603)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:246)