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

getCauses()[0].getUser() not giving username after timeout in Pipeline

      Below code stopped working after updating plugins recently(pipeline API)

                          try {
                              timeout(time: 15, unit: 'MINUTES') {
                                  input message: 'Do you want to skip the Random wait ? Click on Proceed', submitter: 'username'
                              }
                          } catch (err) \{
                              def user = err.getCauses()[0].getUser()
                              if('SYSTEM' == user.toString()) { //timeout
                                  echo "Input timeout expired, continueing with the next stages"
                                  currentBuild.result = "SUCCESS"
                              } else \{
                                  echo "Input aborted by: [${user}]"
                                  currentBuild.result = "ABORTED"
                                  return
                              }
                          }
      

      Abort works, but after timeout it started throw below exceptions.

      Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 89493efb-8a18-4803-9e27-3e25c6ab1a74
      hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: org.jenkinsci.plugins.workflow.steps.FlowInterruptedException.getAt() is applicable for argument types: () values: []
      Possible solutions: getAt(java.lang.String), putAt(java.lang.String, java.lang.Object), wait(), grep(), wait(long), grep(java.lang.Object)
      at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:159)
      at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:178)
      at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:182)
      at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
      at org.jenkinsci.plugins.workflow.cps.LoggingInvoker.methodCall(LoggingInvoker.java:105)
      at WorkflowScript.run(WorkflowScript:14)
      at _{}cps.transform{}_(Native Method)
      at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:90)
      at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:116)
      at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixName(FunctionCallBlock.java:80)
      at jdk.internal.reflect.GeneratedMethodAccessor180.invoke(Unknown Source)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.base/java.lang.reflect.Method.invoke(Unknown Source)
      at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
      at com.cloudbees.groovy.cps.Next.step(Next.java:83)
      at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:147)
      at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:17)
      at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:49)
      at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:180)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:423)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:331)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:295)
      at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService.lambda$wrap$4(CpsVmExecutorService.java:136)
      at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
      at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
      at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
      at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51)
      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.call(CpsVmExecutorService.java:53)
      at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.call(CpsVmExecutorService.java:50)
      at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:136)
      at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:275)
      at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService.lambda$categoryThreadFactory$0(CpsVmExecutorService.java:50)
      at java.base/java.lang.Thread.run(Unknown Source)
      Finished: FAILURE

        1. JENKINS-73194.zip
          35 kB
        2. plugins.txt
          2 kB
        3. run-jenkins.sh
          0.9 kB
        4. sample-pipeline.groovy
          0.9 kB

          [JENKINS-73194] getCauses()[0].getUser() not giving username after timeout in Pipeline

          Mark Waite added a comment - - edited

          Thanks for reporting the issue. I can see the same message when I run a Pipeline that includes that script. Pipeline input step 491.vb_07d21da_1a_fb_ does not fail, but Pipeline input step 495.ve9c153f6067b_ fails.

          The steps I took to duplicate the problem included:

          1. Create a plugins.txt file that lists the exact plugin and their versions
          2. Create a run-jenkins.sh shell script that downloads Jenkins 2.452.1 and those plugins and runs it
          3. Run the run-jenkins.sh shell script and complete the setup wizard by adding a new user and choosing to install no additional plugins
          4. Define a Pipeline job that uses the declarative Pipeline in sample-pipeline.groovy
          5. Run the Pipeline and note that it requires script approval
          6. Use "Manage Jenkins" -> "In process script approval" to approve the methods used in the script
          7. Run the Pipeline again and confirm that it passes with Pipeline input step 491.x
          8. Upgrade the Pipeline input step plugin to 495.x using the plugin manager and restart Jenkins
          9. Run the Pipeline and confirm that it fails with an exception

          I'm not yet confident that the change of behavior is unexpected. PR-160 is specifically changing abort cause behavior. I'll hope that julieheard is willing to investigate further.

          Mark Waite added a comment - - edited Thanks for reporting the issue. I can see the same message when I run a Pipeline that includes that script. Pipeline input step 491.vb_07d21da_1a_fb_ does not fail, but Pipeline input step 495.ve9c153f6067b_ fails. The steps I took to duplicate the problem included: Create a plugins.txt file that lists the exact plugin and their versions Create a run-jenkins.sh shell script that downloads Jenkins 2.452.1 and those plugins and runs it Run the run-jenkins.sh shell script and complete the setup wizard by adding a new user and choosing to install no additional plugins Define a Pipeline job that uses the declarative Pipeline in sample-pipeline.groovy Run the Pipeline and note that it requires script approval Use "Manage Jenkins" -> "In process script approval" to approve the methods used in the script Run the Pipeline again and confirm that it passes with Pipeline input step 491.x Upgrade the Pipeline input step plugin to 495.x using the plugin manager and restart Jenkins Run the Pipeline and confirm that it fails with an exception I'm not yet confident that the change of behavior is unexpected. PR-160 is specifically changing abort cause behavior. I'll hope that julieheard is willing to investigate further.

          Mark Waite added a comment -

          I've uploaded JENKINS-73194.zip as a zip archive of the git repository where I performed the testing. It includes the sample job definitions and the script approvals.

          Mark Waite added a comment - I've uploaded JENKINS-73194.zip as a zip archive of the git repository where I performed the testing. It includes the sample job definitions and the script approvals.

          Basavaraj added a comment -

          Thank you markewaite for looking into it. I will wait for julieheard response.

          Basavaraj added a comment - Thank you markewaite for looking into it. I will wait for julieheard response.

            Unassigned Unassigned
            basavarajmane Basavaraj
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: