Infinite loop / Stack overflow when using a setter in pipeline

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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.

            Assignee:
            Andrew Bayer
            Reporter:
            Gijs Kunze
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: