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

Infinite loop / Stack overflow when using a specific setter in pipeline

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: In Review (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: workflow-cps-plugin
    • Labels:
      None
    • Environment:
      workflow-cps 2.53
      jenkins 2.73.1
    • Similar Issues:

      Description

      Related to JENKINS-41248

      Use this raw script to reproduce:

      class A {
        private int x
        void setX(int x) { this.x = x }
      }
      class B {
        private int x
        void setX(int v) { this.x = v }
      }
      class C {
        private int x
        void setX(int v) { x = v }
      }
      class D {
        private int x
        void setX(int v) { x = v }
        int getX() { x }
      }
      
      new A().setX(12)
      println 'A setter is good'
      new B().setX(12)
      println 'C setter is good'
      new D().setX(12)
      println 'D setter is good'
      new C().setX(12)
      println 'We never reach here'
      

      class A uses a standard setter, parameter with same name, assigning to this.field (works fine)

      class B setter has a parameter with a different name, but still assign to this.field (works fine)

      class C setter has a parameter with a different name, and assign without using this.field (works fine outside of jenkins, with groovy-2.4.7 at least, but fails within a pipeline)

      class D is the same as C, but with a standard getter defined (works fine)

       

      With an older version of the plugin (2.40 i think), the job was just stuck. With the latest (2.53 as of now), we have this exception:

      java.lang.StackOverflowError: Excessively nested closures/functions at C.setX(WorkflowScript:11) - look for unbounded recursion - call depth: 1025
      	at com.cloudbees.groovy.cps.impl.CpsFunction.invoke(CpsFunction.java:28)
      	at com.cloudbees.groovy.cps.impl.CpsCallableInvocation.invoke(CpsCallableInvocation.java:40)
      	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:62)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixName(FunctionCallBlock.java:77)
      

      At least the workaround is simple, but the bug is still disturbing.

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            seyguai Nicolas Boussuge
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: