Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-20857

Default Run Parameter on First Triggered Job Causes NullPointerException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • 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)

            Unassigned Unassigned
            nerdmachine Duane Bronson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: