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

Illegal 'break' statement in Jenkinsfile freeze Jenkins resources

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • workflow-cps-plugin
    • Jenkins 2.150.2
      Groovy 2.0/2.2
      Pipeline 2.5/2.6

      When there is an illegal 'break' statement exists, the job fails and finish. However, from Main page, job are not reported as failed/finished but hangs. It consumes the execution slot of the slave and never quit. 

      A quick script to reproduce this:

      ```

      node('linux')

      {  break; }

      ```

       

      The output of the execution:

      ```
      ‘...’ is offline
      Running on ... in /home/ubuntu/workspace/s_devops-deploy-tool-test_master[Pipeline] {[Pipeline] End of PipelineGitHub has been notified of this commit’s build result

      java.lang.IllegalStateException: unexpected break statement
      at com.cloudbees.groovy.cps.impl.CallEnv.getBreakAddress(CallEnv.java:102)
      at com.cloudbees.groovy.cps.impl.ProxyEnv.getBreakAddress(ProxyEnv.java:52)
      at com.cloudbees.groovy.cps.impl.ProxyEnv.getBreakAddress(ProxyEnv.java:52)
      at com.cloudbees.groovy.cps.impl.BreakBlock.eval(BreakBlock.java:21)
      at com.cloudbees.groovy.cps.Next.step(Next.java:83)
      at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
      at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
      at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
      at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
      at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
      at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
      at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
      at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:347)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:259)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:247)
      at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
      at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
      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)
      Finished: FAILURE
       
      When I change the statement `break` to others like `return`, `throw Exception...` or even illegal keywords, things runs as expected. 
      Have tried different combinations of plug-ins but it does not seem related. 

            dnusbaum Devin Nusbaum
            cheney Cheney Yan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: