[JIRA] (JENKINS-38566) Unexpected break statement hangs the build

41 views
Skip to first unread message

eeaston@ahl.com (JIRA)

unread,
Sep 28, 2016, 7:20:02 AM9/28/16
to jenkinsc...@googlegroups.com
Edward Easton created an issue
 
Jenkins / Bug JENKINS-38566
Unexpected break statement hangs the build
Issue Type: Bug Bug
Assignee: Unassigned
Components: pipeline-build-step-plugin
Created: 2016/Sep/28 11:19 AM
Environment: jenkins 2.7.4, build-step-plugin 2.3
Priority: Major Major
Reporter: Edward Easton

A pipeline script with an unexpected break statement like this:

break

.. will hang the build with no feedback.

The traceback in the server log is:

WARNING: Unexpected exception in CPS VM thread: CpsFlowExecution[Owner[pipeline-scratch2/29:pipeline-scratch2 #29]]
java.lang.IllegalStateException: unexpected break statement
        at com.cloudbees.groovy.cps.impl.CallEnv.getBreakAddress(CallEnv.java:62)
        at com.cloudbees.groovy.cps.impl.ProxyEnv.getBreakAddress(ProxyEnv.java:44)
        at com.cloudbees.groovy.cps.impl.ProxyEnv.getBreakAddress(ProxyEnv.java:44)
        at com.cloudbees.groovy.cps.impl.BreakBlock.eval(BreakBlock.java:21)
        at com.cloudbees.groovy.cps.Next.step(Next.java:58)
        at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
        at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
        at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
        at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
        at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
        at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
        at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
        at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        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:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

eeaston@ahl.com (JIRA)

unread,
Sep 28, 2016, 7:46:02 AM9/28/16
to jenkinsc...@googlegroups.com
Edward Easton commented on Bug JENKINS-38566
 
Re: Unexpected break statement hangs the build

FWIW this came about due to the changes to the stage() step semantics - I had code nested inside a stage {} block that was itself within a for loop. The break statement was now within a closure and without any context. The worst bit about this is that the thread dump points to the previous line in the code

jglick@cloudbees.com (JIRA)

unread,
Nov 1, 2016, 6:23:02 PM11/1/16
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
 
Change By: Jesse Glick
Component/s: workflow-cps-plugin
Component/s: pipeline-build-step-plugin

ryan.campbell@gmail.com (JIRA)

unread,
Dec 29, 2016, 10:14:01 AM12/29/16
to jenkinsc...@googlegroups.com
recampbell updated an issue
Change By: recampbell
Labels: pipeline-hangs

jglick@cloudbees.com (JIRA)

unread,
Dec 29, 2016, 1:08:01 PM12/29/16
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-38566
 
Re: Unexpected break statement hangs the build

Besides fixing the language bug (CallEnv.getBreakAddress should I guess be throwing a CpsCallableInvocation wrapper), the program ought to be treated as finished when some miscellaneous exception is thrown from the CPS VM thread.

andrew.bayer@gmail.com (JIRA)

unread,
Feb 23, 2018, 3:29:02 PM2/23/18
to jenkinsc...@googlegroups.com

Jesse Glick - what should be in that CpsCallableInvocationWrapper?

This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

andrew.bayer@gmail.com (JIRA)

unread,
Feb 23, 2018, 3:31:03 PM2/23/18
to jenkinsc...@googlegroups.com

and fwiw, this doesn't seem to hang the build any more (at least as of workflow-cps 2.45 on my testbed) - the build fails as it would from any other exception, at least with this example:

stage('foo') {
  echo "hello"
  break
}

andrew.bayer@gmail.com (JIRA)

unread,
Nov 16, 2018, 9:44:02 AM11/16/18
to jenkinsc...@googlegroups.com
Andrew Bayer resolved as Cannot Reproduce
 
Change By: Andrew Bayer
Status: Open Resolved
Resolution: Cannot Reproduce
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)
Reply all
Reply to author
Forward
0 new messages