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

NullPointerException in EnvInjectBuilderContributionAction.buildEnvVars during SCM poll

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: envinject-plugin
    • Labels:
      None
    • Environment:
      EnvInject 1.60, Jenkins 1.473
    • Similar Issues:

      Description

      For quite some time, all of our jobs have been randomly going into a state where SCM polling starts failing with the following stack:

      Started on Jul 10, 2012 9:39:45 AM
      ERROR: Failed to record SCM polling for hudson.model.FreeStyleProject@7e1eb84f[anonymous_libs]
      java.lang.NullPointerException
      	at java.util.TreeMap.putAll(Unknown Source)
      	at org.jenkinsci.plugins.envinject.EnvInjectBuilderContributionAction.buildEnvVars(EnvInjectBuilderContributionAction.java:23)
      	at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:867)
      	at hudson.scm.SubversionSCM.compareRemoteRevisionWith(SubversionSCM.java:1114)
      	at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
      	at hudson.scm.SCM.poll(SCM.java:373)
      	at hudson.model.AbstractProject.poll(AbstractProject.java:1377)
      	at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:420)
      	at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:449)
      	at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.lang.Thread.run(Unknown Source)
      

      When a job goes into this state, it never gets out of it unless a user kicks off a build manually. When that happens, SCM polling for that job start working again for a short time.

      I'm attaching an anoymized config file for this particular job.

        Attachments

          Activity

          Hide
          xkyu xkyu kim added a comment -

          I got the same problem always when I restarted Jenkins. (Jenkins 1.447.2 and EnvInject 1.60)

          ERROR: Failed to record SCM polling
          java.lang.NullPointerException
          	at java.util.TreeMap.putAll(TreeMap.java:290)
          	at org.jenkinsci.plugins.envinject.EnvInjectBuilderContributionAction.buildEnvVars(EnvInjectBuilderContributionAction.java:23)
          	at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:840)
          	at hudson.scm.SubversionSCM.compareRemoteRevisionWith(SubversionSCM.java:1114)
          	at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
          	at hudson.scm.SCM.poll(SCM.java:373)
          	at hudson.model.AbstractProject.poll(AbstractProject.java:1323)
          	at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:420)
          	at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:449)
          	at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
          	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
          	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          	at java.lang.Thread.run(Thread.java:662)
          
          Show
          xkyu xkyu kim added a comment - I got the same problem always when I restarted Jenkins. (Jenkins 1.447.2 and EnvInject 1.60) ERROR: Failed to record SCM polling java.lang.NullPointerException at java.util.TreeMap.putAll(TreeMap.java:290) at org.jenkinsci.plugins.envinject.EnvInjectBuilderContributionAction.buildEnvVars(EnvInjectBuilderContributionAction.java:23) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:840) at hudson.scm.SubversionSCM.compareRemoteRevisionWith(SubversionSCM.java:1114) at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356) at hudson.scm.SCM.poll(SCM.java:373) at hudson.model.AbstractProject.poll(AbstractProject.java:1323) at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:420) at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:449) at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/org/jenkinsci/plugins/envinject/EnvInjectBuilderContributionAction.java
          http://jenkins-ci.org/commit/envinject-plugin/4282ddca174519d902ceb676237a7edbfdc20a8f
          Log:
          Fix JENKINS-14371

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/envinject/EnvInjectBuilderContributionAction.java http://jenkins-ci.org/commit/envinject-plugin/4282ddca174519d902ceb676237a7edbfdc20a8f Log: Fix JENKINS-14371
          Hide
          xkyu xkyu kim added a comment -

          NullPointerEception with envinject-1.62.(EnvInjectBuilderContributionAction.java:24)

          ERROR: Failed to record SCM polling
          java.lang.NullPointerException
          at java.util.TreeMap.putAll(TreeMap.java:290)
          at org.jenkinsci.plugins.envinject.EnvInjectBuilderContributionAction.buildEnvVars(EnvInjectBuilderContributionAction.java:24)
          at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:840)
          at hudson.scm.SubversionSCM.compareRemoteRevisionWith(SubversionSCM.java:1114)
          at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
          at hudson.scm.SCM.poll(SCM.java:373)
          at hudson.model.AbstractProject.poll(AbstractProject.java:1323)
          at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:420)
          at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:449)
          at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
          at java.util.concurrent.FutureTask.run(FutureTask.java:138)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:662)

          Show
          xkyu xkyu kim added a comment - NullPointerEception with envinject-1.62.(EnvInjectBuilderContributionAction.java:24) ERROR: Failed to record SCM polling java.lang.NullPointerException at java.util.TreeMap.putAll(TreeMap.java:290) at org.jenkinsci.plugins.envinject.EnvInjectBuilderContributionAction.buildEnvVars(EnvInjectBuilderContributionAction.java:24) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:840) at hudson.scm.SubversionSCM.compareRemoteRevisionWith(SubversionSCM.java:1114) at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356) at hudson.scm.SCM.poll(SCM.java:373) at hudson.model.AbstractProject.poll(AbstractProject.java:1323) at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:420) at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:449) at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)
          Hide
          gbois Gregory Boissinot added a comment -

          According to the stack trace, it is not possible to be append with the source of EnvInject 1.62. Therefore, it should be a version mistaken.
          Please check you are using the right version.

          Show
          gbois Gregory Boissinot added a comment - According to the stack trace, it is not possible to be append with the source of EnvInject 1.62. Therefore, it should be a version mistaken. Please check you are using the right version.
          Hide
          oldelvet Richard Mortimer added a comment -

          The new crash happens on line 24 of EnvInjectBuilderContributionAction and this is consistent with the latest source in git.

          I think the problem might be that resultVariables is null or contains a null key. The crash happens inside of putAll so envVars must be non-null. The javadoc for putAll does state that it will raise NPE if it is null or contains a null key.

          http://docs.oracle.com/javase/6/docs/api/java/util/TreeMap.html#putAll%28java.util.Map%29

          Show
          oldelvet Richard Mortimer added a comment - The new crash happens on line 24 of EnvInjectBuilderContributionAction and this is consistent with the latest source in git. I think the problem might be that resultVariables is null or contains a null key. The crash happens inside of putAll so envVars must be non-null. The javadoc for putAll does state that it will raise NPE if it is null or contains a null key. http://docs.oracle.com/javase/6/docs/api/java/util/TreeMap.html#putAll%28java.util.Map%29
          Hide
          gabrielegiuseppini Gabriele Giuseppini added a comment -

          Agreed with Richard - bug is still alive, and it has to do with resultVariables.

          Show
          gabrielegiuseppini Gabriele Giuseppini added a comment - Agreed with Richard - bug is still alive, and it has to do with resultVariables.
          Hide
          gabrielegiuseppini Gabriele Giuseppini added a comment -

          Gregory, if it helps, we also see this during a promotion job - stack is slightly different (originating from the SVNTag plugin) but last few calls are the same:

          build hudson.tasks.BatchFile@7844e5f5 SUCCESS
          FATAL: null
          ha:AAAAWB+LCAAAAAAAAABb85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=java.lang.NullPointerException
          	at java.util.TreeMap.putAll(Unknown Source)
          	at org.jenkinsci.plugins.envinject.EnvInjectBuilderContributionAction.buildEnvVars(EnvInjectBuilderContributionAction.java:24)
          	at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:867)
          	at hudson.plugins.svn_tag.SvnTagPlugin.perform(SvnTagPlugin.java:87)
          	at hudson.plugins.svn_tag.SvnTagPublisher.perform(SvnTagPublisher.java:79)
          	at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:158)
          	at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:127)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
          	at hudson.model.Run.execute(Run.java:1488)
          	at hudson.model.Run.run(Run.java:1434)
          	at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:102)
          	at hudson.model.ResourceController.execute(ResourceController.java:88)
          	at hudson.model.Executor.run(Executor.java:236)
          
          
          Show
          gabrielegiuseppini Gabriele Giuseppini added a comment - Gregory, if it helps, we also see this during a promotion job - stack is slightly different (originating from the SVNTag plugin) but last few calls are the same: build hudson.tasks.BatchFile@7844e5f5 SUCCESS FATAL: null ha:AAAAWB+LCAAAAAAAAABb85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=java.lang.NullPointerException at java.util.TreeMap.putAll(Unknown Source) at org.jenkinsci.plugins.envinject.EnvInjectBuilderContributionAction.buildEnvVars(EnvInjectBuilderContributionAction.java:24) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:867) at hudson.plugins.svn_tag.SvnTagPlugin.perform(SvnTagPlugin.java:87) at hudson.plugins.svn_tag.SvnTagPublisher.perform(SvnTagPublisher.java:79) at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:158) at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:127) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499) at hudson.model.Run.execute(Run.java:1488) at hudson.model.Run.run(Run.java:1434) at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:102) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:236)

            People

            • Assignee:
              gbois Gregory Boissinot
              Reporter:
              gabrielegiuseppini Gabriele Giuseppini
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: