• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • pipeline
    • None

      If a step throws an AbortException, the intent is that this is displayed as a single-line error with no stack trace. Yet if this is inside a parallel step, it gets wrapped, twice, and the full stack trace printed to the log:

      Running: End of Workflow
      org.jenkinsci.plugins.workflow.cps.steps.ParallelStepException: Parallel step split3 failed
      	at org.jenkinsci.plugins.workflow.cps.steps.ParallelStep$ResultHandler$Callback.checkAllDone(ParallelStep.java:126)
      	at org.jenkinsci.plugins.workflow.cps.steps.ParallelStep$ResultHandler$Callback.onFailure(ParallelStep.java:105)
      	at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$FailureAdapter.receive(CpsBodyExecution.java:295)
      	at com.cloudbees.groovy.cps.impl.ThrowBlock$1.receive(ThrowBlock.java:68)
      	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
      	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
      	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:145)
      	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:262)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:70)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:174)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:172)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:111)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.reflect.UndeclaredThrowableException
      	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.replay(CpsStepContext.java:409)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:164)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:98)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
      	at WorkflowScript.run(WorkflowScript:15)
      	at Unknown.Unknown(Unknown)
      	at ___cps.transform___(Native Method)
      	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:69)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:100)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:76)
      	at sun.reflect.GeneratedMethodAccessor133.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
      	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
      	at sun.reflect.GeneratedMethodAccessor153.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	... 17 more
      Caused by: hudson.AbortException: None of the test reports contained any result
      	at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:158)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:64)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:55)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:34)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:137)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:98)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
      	... 30 more
      Finished: FAILURE
      

      My suggestion: make ParallelStepException extend UndeclaredThrowableException, which ErrorAction unwraps automatically; rewrap a UndeclaredThrowableException thrown by replay (or, better, make whatever calls replay and turns it into an Outcome do this unwrapping); and if the inner exception is an AbortException, throw a wrapping AbortException which just prepends the branch name.

          [JENKINS-25894] Ugly reporting of errors from parallel step

          Jesse Glick created issue -

          Jesse Glick added a comment -

          Another problem is that FlowInterruptedException is handled specially, but this is lost when it is wrapped in ParallelStepException, so for example the build in TimeoutStepTest.killingParallel winds up as FAILURE when it ought to have been ABORTED. Thus the several places that check for instanceof FlowInterruptedException (currently CpsThreadGroup.run, CatchErrorStep, and WorkflowRun.finish) needs to look for nested causes.

          Jesse Glick added a comment - Another problem is that FlowInterruptedException is handled specially, but this is lost when it is wrapped in ParallelStepException , so for example the build in TimeoutStepTest.killingParallel winds up as FAILURE when it ought to have been ABORTED . Thus the several places that check for instanceof FlowInterruptedException (currently CpsThreadGroup.run , CatchErrorStep , and WorkflowRun.finish ) needs to look for nested causes.

          Jesse Glick added a comment -

          JENKINS-26541 dealt with the handling of RejectedAccessException.

          Jesse Glick added a comment - JENKINS-26541 dealt with the handling of RejectedAccessException .
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-26541 [ JENKINS-26541 ]
          Jesse Glick made changes -
          Assignee Original: Kohsuke Kawaguchi [ kohsuke ]

          Jesse Glick added a comment -

          ErrorAction no longer unwraps anything. replay must have referred to the method in CpsStepContext. InvokerInvocationException now seems to be the relevant exception type.

          Jesse Glick added a comment - ErrorAction no longer unwraps anything. replay must have referred to the method in CpsStepContext . InvokerInvocationException now seems to be the relevant exception type.
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-28119 [ JENKINS-28119 ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "workflow-cps PR 6 (Web Link)" [ 14192 ]

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStep.java
          src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStepException.java
          src/test/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStepTest.java
          http://jenkins-ci.org/commit/workflow-cps-plugin/e0ca68f17d3eeeb52ca0db73ff1bf10e2558bfe6
          Log:
          [FIXED JENKINS-25894] Fix reporting of errors from parallel step.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStep.java src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStepException.java src/test/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStepTest.java http://jenkins-ci.org/commit/workflow-cps-plugin/e0ca68f17d3eeeb52ca0db73ff1bf10e2558bfe6 Log: [FIXED JENKINS-25894] Fix reporting of errors from parallel step.

            Unassigned Unassigned
            jglick Jesse Glick
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: