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

Infinite loop / Stack overflow when using a setter in pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • pipeline
    • None
    • Tested on Jenkins 2.32.1 LTS and 2.21

      We ran into a weird problem where our pipeline jobs would hang and have to be hard killed. After debugging and reducing the code to create a minimal example that would cause the issue we discovered the issue was the fact we were using a class with a setter (crazy, I know). This simple script causes the Run to hang indefinitely:

      class Foo {
          private int a;
          
          public void setA(int a) {
              this.a = a;
          }
      }
      
      
      Foo foo = new Foo();
      foo.setA(10);
      

      It hangs when calling `setA` and when you kill the job the logs show:

      Jan 20, 2017 11:00:41 AM org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService reportProblem
      WARNING: Unexpected exception in CPS VM thread: CpsFlowExecution[Owner[test/2:test #2]]
      java.lang.StackOverflowError
          at com.cloudbees.groovy.cps.impl.CallEnv.getExceptionHandler(CallEnv.java:95)
          at com.cloudbees.groovy.cps.impl.ProxyEnv.getExceptionHandler(ProxyEnv.java:56)
      

      Simply renaming the method and call to anything that doesn't look like a setter (xsetFoo for example) makes the pipeline work.

            abayer Andrew Bayer
            gijsk Gijs Kunze
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: