Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Component/s: core
    • Labels:
    • Environment:
      Jenkins 2.72
    • Similar Issues:

      Description

      Within the current Jenkins, the upstrem-trigger mechanism fails with a NPE.

      To see the error, just create two "Pipeline" projects via Jenkins Web-UI:

      First is named "Kevin", the script is:

      pipeline {
      
        agent any
      
        stages {
          stage("Hello") {
            steps {
                script {
                    sh "echo Kevin here"
                }
            }
          }
        }
      
      }
      

      Starting this project works fine.

      Now, second project is named "Chantalle", the script is:

      pipeline {
      
        agent any
      
        triggers {
          upstream(
            threshold: hudson.model.Result.SUCCESS,
            upstreamProjects: "../Kevin"
          )
        }
      
        stages {
          stage("Hello") {
            steps {
                script {
                    sh "echo Chantalle here"
                }
            }
          }
        }
      
      }
      

      Similar, starting this project at its own works fine.

      But when starting "Kevin" again, I expect "Chantalle" to be executed afterwards. Instead, a NPE is thrown, and "Chantalle" does not start:

      Aug 01, 2017 1:39:38 PM org.jenkinsci.plugins.workflow.job.WorkflowRun finish
      INFO: Kevin #6 completed: SUCCESS
      Aug 01, 2017 1:39:38 PM hudson.model.listeners.RunListener report
      WARNING: RunListener failed
      java.lang.NullPointerException
          at java.util.StringTokenizer.<init>(StringTokenizer.java:199)
          at java.util.StringTokenizer.<init>(StringTokenizer.java:221)
          at hudson.model.Items.fromNameList(Items.java:231)
          at jenkins.triggers.ReverseBuildTrigger$RunListenerImpl.calculateCache(ReverseBuildTrigger.java:256)
          at jenkins.triggers.ReverseBuildTrigger$RunListenerImpl.onCompleted(ReverseBuildTrigger.java:279)
          at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:211)
          at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:663)
          at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1400(WorkflowRun.java:134)
          at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:966)
          at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1221)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:407)
          at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:35)
          at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
          at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
      

        Attachments

          Issue Links

            Activity

            ghostcity Stefan Gasterstädt created issue -
            ghostcity Stefan Gasterstädt made changes -
            Field Original Value New Value
            Description Within the current Jenkins, the upstrem-trigger mechanism fails with a NPE.

            To see the error, just create two "Pipeline" projects via Jenkins Web-UI:

            First is named "Kevin", the script is:
            {code:java}
            pipeline {

              agent any

              stages {
                stage("Hello") {
                  steps {
                      script {
                          sh "echo Kevin here"
                      }
                  }
                }
              }

            }
            {code}

            Second is named "Chantalle", the script is:
            {code}
            pipeline {

              agent any

              triggers {
                upstream(
                  threshold: hudson.model.Result.SUCCESS,
                  upstreamProjects: "../Kevin"
                )
              }

              stages {
                stage("Hello") {
                  steps {
                      script {
                          sh "echo Chantalle here"
                      }
                  }
                }
              }

            }
            {code}
            Within the current Jenkins, the upstrem-trigger mechanism fails with a NPE.

            To see the error, just create two "Pipeline" projects via Jenkins Web-UI:

            First is named "Kevin", the script is:
            {code:java}
            pipeline {

              agent any

              stages {
                stage("Hello") {
                  steps {
                      script {
                          sh "echo Kevin here"
                      }
                  }
                }
              }

            }
            {code}

            Starting this project works fine.

            Now, second project is named "Chantalle", the script is:
            {code}
            pipeline {

              agent any

              triggers {
                upstream(
                  threshold: hudson.model.Result.SUCCESS,
                  upstreamProjects: "../Kevin"
                )
              }

              stages {
                stage("Hello") {
                  steps {
                      script {
                          sh "echo Chantalle here"
                      }
                  }
                }
              }

            }
            {code}

            Again, starting this project works fine.

            But when starting "Kevin" again, I expect "Chantalle" to be executed afterwards. Instead, a NPE is thrown, and "Chantalle" does not start:

            {code}
            Aug 01, 2017 1:39:38 PM org.jenkinsci.plugins.workflow.job.WorkflowRun finish
            INFO: Kevin #6 completed: SUCCESS
            Aug 01, 2017 1:39:38 PM hudson.model.listeners.RunListener report
            WARNING: RunListener failed
            java.lang.NullPointerException
                at java.util.StringTokenizer.<init>(StringTokenizer.java:199)
                at java.util.StringTokenizer.<init>(StringTokenizer.java:221)
                at hudson.model.Items.fromNameList(Items.java:231)
                at jenkins.triggers.ReverseBuildTrigger$RunListenerImpl.calculateCache(ReverseBuildTrigger.java:256)
                at jenkins.triggers.ReverseBuildTrigger$RunListenerImpl.onCompleted(ReverseBuildTrigger.java:279)
                at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:211)
                at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:663)
                at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1400(WorkflowRun.java:134)
                at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:966)
                at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1221)
                at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:407)
                at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:35)
                at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
                at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at java.lang.Thread.run(Thread.java:748)
            {code}
            ghostcity Stefan Gasterstädt made changes -
            Description Within the current Jenkins, the upstrem-trigger mechanism fails with a NPE.

            To see the error, just create two "Pipeline" projects via Jenkins Web-UI:

            First is named "Kevin", the script is:
            {code:java}
            pipeline {

              agent any

              stages {
                stage("Hello") {
                  steps {
                      script {
                          sh "echo Kevin here"
                      }
                  }
                }
              }

            }
            {code}

            Starting this project works fine.

            Now, second project is named "Chantalle", the script is:
            {code}
            pipeline {

              agent any

              triggers {
                upstream(
                  threshold: hudson.model.Result.SUCCESS,
                  upstreamProjects: "../Kevin"
                )
              }

              stages {
                stage("Hello") {
                  steps {
                      script {
                          sh "echo Chantalle here"
                      }
                  }
                }
              }

            }
            {code}

            Again, starting this project works fine.

            But when starting "Kevin" again, I expect "Chantalle" to be executed afterwards. Instead, a NPE is thrown, and "Chantalle" does not start:

            {code}
            Aug 01, 2017 1:39:38 PM org.jenkinsci.plugins.workflow.job.WorkflowRun finish
            INFO: Kevin #6 completed: SUCCESS
            Aug 01, 2017 1:39:38 PM hudson.model.listeners.RunListener report
            WARNING: RunListener failed
            java.lang.NullPointerException
                at java.util.StringTokenizer.<init>(StringTokenizer.java:199)
                at java.util.StringTokenizer.<init>(StringTokenizer.java:221)
                at hudson.model.Items.fromNameList(Items.java:231)
                at jenkins.triggers.ReverseBuildTrigger$RunListenerImpl.calculateCache(ReverseBuildTrigger.java:256)
                at jenkins.triggers.ReverseBuildTrigger$RunListenerImpl.onCompleted(ReverseBuildTrigger.java:279)
                at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:211)
                at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:663)
                at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1400(WorkflowRun.java:134)
                at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:966)
                at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1221)
                at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:407)
                at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:35)
                at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
                at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at java.lang.Thread.run(Thread.java:748)
            {code}
            Within the current Jenkins, the upstrem-trigger mechanism fails with a NPE.

            To see the error, just create two "Pipeline" projects via Jenkins Web-UI:

            First is named "Kevin", the script is:
            {code:java}
            pipeline {

              agent any

              stages {
                stage("Hello") {
                  steps {
                      script {
                          sh "echo Kevin here"
                      }
                  }
                }
              }

            }
            {code}

            Starting this project works fine.

            Now, second project is named "Chantalle", the script is:
            {code}
            pipeline {

              agent any

              triggers {
                upstream(
                  threshold: hudson.model.Result.SUCCESS,
                  upstreamProjects: "../Kevin"
                )
              }

              stages {
                stage("Hello") {
                  steps {
                      script {
                          sh "echo Chantalle here"
                      }
                  }
                }
              }

            }
            {code}

            Similar, starting this project at its own works fine.

            But when starting "Kevin" again, I expect "Chantalle" to be executed afterwards. Instead, a NPE is thrown, and "Chantalle" does not start:

            {code}
            Aug 01, 2017 1:39:38 PM org.jenkinsci.plugins.workflow.job.WorkflowRun finish
            INFO: Kevin #6 completed: SUCCESS
            Aug 01, 2017 1:39:38 PM hudson.model.listeners.RunListener report
            WARNING: RunListener failed
            java.lang.NullPointerException
                at java.util.StringTokenizer.<init>(StringTokenizer.java:199)
                at java.util.StringTokenizer.<init>(StringTokenizer.java:221)
                at hudson.model.Items.fromNameList(Items.java:231)
                at jenkins.triggers.ReverseBuildTrigger$RunListenerImpl.calculateCache(ReverseBuildTrigger.java:256)
                at jenkins.triggers.ReverseBuildTrigger$RunListenerImpl.onCompleted(ReverseBuildTrigger.java:279)
                at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:211)
                at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:663)
                at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1400(WorkflowRun.java:134)
                at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:966)
                at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1221)
                at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:407)
                at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:35)
                at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
                at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at java.lang.Thread.run(Thread.java:748)
            {code}
            Hide
            ghostcity Stefan Gasterstädt added a comment -

            Taking a look into the code tells me, the first argument for Java's StringTokenizer is null. This is weird, because its value should be taken from Pipline script's file

            [...]
                  upstreamProjects: "../Kevin"
            [...]
            
            Show
            ghostcity Stefan Gasterstädt added a comment - Taking a look into the code tells me, the first argument for Java's StringTokenizer is null. This is weird, because its value should be taken from Pipline script's file [...] upstreamProjects: "../Kevin" [...]
            ghostcity Stefan Gasterstädt made changes -
            Component/s pipeline-model-definition-plugin [ 21706 ]
            Hide
            tumbl3w33d Sir Tumbleweed added a comment -

            Andrew Bayer is there any temporary workaround to this? It seems quite critical to me that the upstream trigger completely doesn't work with the latest revisions. Can you tell which plugins (or jenkins core?) I could downgrade to get around this issue and get my toolchain running again?

            Show
            tumbl3w33d Sir Tumbleweed added a comment - Andrew Bayer is there any temporary workaround to this? It seems quite critical to me that the upstream trigger completely doesn't work with the latest revisions. Can you tell which plugins (or jenkins core?) I could downgrade to get around this issue and get my toolchain running again?
            abayer Andrew Bayer made changes -
            Assignee Andrew Bayer [ abayer ]
            Hide
            abayer Andrew Bayer added a comment -

            Will check on this today.

            Show
            abayer Andrew Bayer added a comment - Will check on this today.
            Hide
            abayer Andrew Bayer added a comment -

            Ok, so far, this works with core 2.60 and workflow-job 2.11 - trying further combinations...

            Show
            abayer Andrew Bayer added a comment - Ok, so far, this works with core 2.60 and workflow-job 2.11 - trying further combinations...
            Hide
            abayer Andrew Bayer added a comment -

            So with latest of everything on 2.72, with new jobs created after upgrading to 2.72, this works. Sir Tumbleweed is uploading the config.xmls for their failing job(s) so I can see why trigger.upstreamProjects is null...

            Show
            abayer Andrew Bayer added a comment - So with latest of everything on 2.72, with new jobs created after upgrading to 2.72, this works. Sir Tumbleweed is uploading the config.xmls for their failing job(s) so I can see why trigger.upstreamProjects is null...
            tumbl3w33d Sir Tumbleweed made changes -
            Attachment Chantalle_config.xml [ 39146 ]
            Attachment Kevin_config.xml [ 39147 ]
            Hide
            tumbl3w33d Sir Tumbleweed added a comment -

            In the attached version of the config.xml you see the upstream job "Kevin" instead of "../Kevin", but that's just from playing around with different notations. It's broken either way.

            Show
            tumbl3w33d Sir Tumbleweed added a comment - In the attached version of the config.xml you see the upstream job "Kevin" instead of "../Kevin", but that's just from playing around with different notations. It's broken either way.
            Hide
            abayer Andrew Bayer added a comment -

            We're nailing this down over IRC at the moment - the problem seems to be that at least one other job has a ReverseBuildTrigger with a null upstreamProjects. That'd cause the NPE in question, even when you're running an unrelated job. So as a workaround while I figure out a real fix for this, you can run https://gist.github.com/abayer/79700ea922e523d2e82a28675b1181e6 in Manage Jenkins -> Script Console to find job(s) with null upstreamProjects. You then need to fix those jobs to make sure they have non-null upstreamProjects and re-run them.

            Meanwhile, I'm trying to decide how we keep this from happening in the future.

            Show
            abayer Andrew Bayer added a comment - We're nailing this down over IRC at the moment - the problem seems to be that at least one other job has a ReverseBuildTrigger with a null upstreamProjects . That'd cause the NPE in question, even when you're running an unrelated job. So as a workaround while I figure out a real fix for this, you can run https://gist.github.com/abayer/79700ea922e523d2e82a28675b1181e6 in Manage Jenkins -> Script Console to find job(s) with null upstreamProjects . You then need to fix those jobs to make sure they have non-null upstreamProjects and re-run them. Meanwhile, I'm trying to decide how we keep this from happening in the future.
            abayer Andrew Bayer made changes -
            Component/s core [ 15593 ]
            Component/s pipeline-model-definition-plugin [ 21706 ]
            Component/s workflow-job-plugin [ 21716 ]
            abayer Andrew Bayer made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            Hide
            tumbl3w33d Sir Tumbleweed added a comment -

            Tons of kudos to Andrew Bayer for this intensive support. We found a nice way to DoS a jenkins' jobs that depend on upstream triggers.

            Show
            tumbl3w33d Sir Tumbleweed added a comment - Tons of kudos to Andrew Bayer for this intensive support. We found a nice way to DoS a jenkins' jobs that depend on upstream triggers.
            Hide
            ghostcity Stefan Gasterstädt added a comment -

            Have been just informed about the problem. Big thank you for your support!

            Show
            ghostcity Stefan Gasterstädt added a comment - Have been just informed about the problem. Big thank you for your support!
            abayer Andrew Bayer made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/jenkins/pull/2966
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "PR #2966 (Web Link)" [ 17411 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java
            test/src/test/java/jenkins/triggers/ReverseBuildTriggerTest.java
            http://jenkins-ci.org/commit/jenkins/f8dd58425f54e27f5bf74a0bb769c50cbb96bc08
            Log:
            [FIXED JENKINS-45909] ReverseBuildTrigger.upstreamProjects should be null safe

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java test/src/test/java/jenkins/triggers/ReverseBuildTriggerTest.java http://jenkins-ci.org/commit/jenkins/f8dd58425f54e27f5bf74a0bb769c50cbb96bc08 Log: [FIXED JENKINS-45909] ReverseBuildTrigger.upstreamProjects should be null safe
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            The fix has been integrated towards Jenkins 2.74. Marking it as LTS candidate.

            IMHO the fix is not ideal, JENKINS-46161 is a follow-up

            Show
            oleg_nenashev Oleg Nenashev added a comment - The fix has been integrated towards Jenkins 2.74. Marking it as LTS candidate. IMHO the fix is not ideal, JENKINS-46161 is a follow-up
            oleg_nenashev Oleg Nenashev made changes -
            Status In Review [ 10005 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            oleg_nenashev Oleg Nenashev made changes -
            Labels lts-candidate
            oleg_nenashev Oleg Nenashev made changes -
            Link This issue is related to JENKINS-46161 [ JENKINS-46161 ]
            olivergondza Oliver Gondža made changes -
            Labels lts-candidate 2.73.1-fixed

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                ghostcity Stefan Gasterstädt
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: