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

Endless loop in DefaultInvoker.getProperty when accessing field via getter/setter without @

      The following script for some reason will make Jenkins go out of memory and will never complete the execution.

      node {
      	HipNotifier chip = new HipNotifier('A')
          echo chip.name	
      }
      
      public class HipNotifier {
          private String name;
      
          public HipNotifier(String pName) {
              this.name = pName
          }
      
          String getName() {
              return name
          }
      }
      

          [JENKINS-31484] Endless loop in DefaultInvoker.getProperty when accessing field via getter/setter without @

          Luca Vitucci created issue -
          Luca Vitucci made changes -
          Description Original: The following script for some reason will make Jenkins go out of memory and will never complete the execution.


          {code:java}
          node {
          HipNotifier chip = new HipNotifier('A', 'B', ["C","D"])
              echo chip.name
          }

          public class HipNotifier {
              private String name;
              private String imageUrl;
              private List<String> quotes;

              public HipNotifier(String pName, String imageUrl, List<String> pQuotes) {
                  this.name = pName
                  this.quotes = pQuotes
                  this.imageUrl = imageUrl
              }

              String getName() {
                  return name
              }

              public String getUrl() {
                  return imageUrl;
              }

              public String getRandomQuote() {
                  return quotes.get(new Random().nextInt(quotes.size()))
              }
          }
          {code}
          New: The following script for some reason will make Jenkins go out of memory and will never complete the execution.


          {code:java}
          node {
          HipNotifier chip = new HipNotifier('A', 'B', ["C", "D"])
              echo chip.name
          }

          public class HipNotifier {
              private String name;
              private String imageUrl;
              private List<String> quotes;

              public HipNotifier(String pName, String imageUrl, List<String> pQuotes) {
                  this.name = pName
                  this.quotes = pQuotes
                  this.imageUrl = imageUrl
              }

              String getName() {
                  return name
              }
          }
          {code}
          Luca Vitucci made changes -
          Description Original: The following script for some reason will make Jenkins go out of memory and will never complete the execution.


          {code:java}
          node {
          HipNotifier chip = new HipNotifier('A', 'B', ["C", "D"])
              echo chip.name
          }

          public class HipNotifier {
              private String name;
              private String imageUrl;
              private List<String> quotes;

              public HipNotifier(String pName, String imageUrl, List<String> pQuotes) {
                  this.name = pName
                  this.quotes = pQuotes
                  this.imageUrl = imageUrl
              }

              String getName() {
                  return name
              }
          }
          {code}
          New: The following script for some reason will make Jenkins go out of memory and will never complete the execution.


          {code:java}
          node {
          HipNotifier chip = new HipNotifier('A')
              echo chip.name
          }

          public class HipNotifier {
              private String name;

              public HipNotifier(String pName) {
                  this.name = pName
              }

              String getName() {
                  return name
              }
          }
          {code}

          Luca Vitucci added a comment - - edited

          I managed to reduce the script up to this, Quite strange, it looks like workflow-plugin does not like new class declarations?

          Luca Vitucci added a comment - - edited I managed to reduce the script up to this, Quite strange, it looks like workflow-plugin does not like new class declarations?

          Luca Vitucci added a comment -

          Update:

          I managed to track it to the actual cause, which is the getter.
          See following example:

          node {
              Something some = new Something('Ciao, Mondo!')
              echo some.name
          }
          
          public class Something {
              private String name
          
              public Something(String name) {
                  this.name = name
              }
          }
          

          That is working fine, instead if we add a getter, it stops working, and hangs jenkins:

          node {
              Something some = new Something('Ciao, Mondo!')
              echo some.name
          }
          
          public class Something {
              private String name
          
              public Something(String name) {
                  this.name = name
              }
          
              String getName() {return name}
          }
          

          Luca Vitucci added a comment - Update: I managed to track it to the actual cause, which is the getter. See following example: node { Something some = new Something( 'Ciao, Mondo!' ) echo some.name } public class Something { private String name public Something( String name) { this .name = name } } That is working fine, instead if we add a getter, it stops working, and hangs jenkins: node { Something some = new Something( 'Ciao, Mondo!' ) echo some.name } public class Something { private String name public Something( String name) { this .name = name } String getName() { return name} }

          Jesse Glick added a comment -

          Reproducible:

          "Computer.threadPoolForRemoting [#4]" … runnable …
             java.lang.Thread.State: RUNNABLE
          	at java.lang.Throwable.fillInStackTrace(Native Method)
          	at java.lang.Throwable.fillInStackTrace(Throwable.java:783)
          	- locked <0x00000007ae52b740> (a org.codehaus.groovy.runtime.InvokerInvocationException)
          	at java.lang.Throwable.<init>(Throwable.java:250)
          	at java.lang.Exception.<init>(Exception.java:54)
          	at java.lang.RuntimeException.<init>(RuntimeException.java:51)
          	at groovy.lang.GroovyRuntimeException.<init>(GroovyRuntimeException.java:49)
          	at org.codehaus.groovy.runtime.InvokerInvocationException.<init>(InvokerInvocationException.java:31)
          	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:97)
          	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
          	at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1612)
          	at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3343)
          	at Something.getProperty(WorkflowScript)
          	at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:156)
          	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:452)
          	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.getProperty(DefaultInvoker.java:25)
          	at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:17)
          	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:62)
          	at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
          	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:54)
          	at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source)
          	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          	at java.lang.reflect.Method.invoke(Method.java:497)
          	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
          	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
          	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:145)
          	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
          	at …
          

          Jesse Glick added a comment - Reproducible: "Computer.threadPoolForRemoting [#4]" … runnable … java.lang.Thread.State: RUNNABLE at java.lang.Throwable.fillInStackTrace(Native Method) at java.lang.Throwable.fillInStackTrace(Throwable.java:783) - locked <0x00000007ae52b740> (a org.codehaus.groovy.runtime.InvokerInvocationException) at java.lang.Throwable.<init>(Throwable.java:250) at java.lang.Exception.<init>(Exception.java:54) at java.lang.RuntimeException.<init>(RuntimeException.java:51) at groovy.lang.GroovyRuntimeException.<init>(GroovyRuntimeException.java:49) at org.codehaus.groovy.runtime.InvokerInvocationException.<init>(InvokerInvocationException.java:31) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:97) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1612) at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3343) at Something.getProperty(WorkflowScript) at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:156) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:452) at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.getProperty(DefaultInvoker.java:25) at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:17) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:62) at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:54) at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) at com.cloudbees.groovy.cps.Next.step(Next.java:58) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:145) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164) at …
          Jesse Glick made changes -
          Labels Original: hang outofmemoryerror New: hang outofmemoryerror robustness
          Jesse Glick made changes -
          Summary Original: Build is going OutOfMemory New: Flow goes into endless loop in DefaultInvoker.getProperty when accessing field via getter
          Jesse Glick made changes -
          Link New: This issue depends on JENKINS-25550 [ JENKINS-25550 ]

          Jesse Glick added a comment -

          A hard kill from JENKINS-25550 allows the build to be marked as aborted, but does not actually kill the CpsVmExecutorService call, so Jenkins will still crash. Probably need to escalate to a Thread.stop in such a case.

          Jesse Glick added a comment - A hard kill from JENKINS-25550 allows the build to be marked as aborted, but does not actually kill the CpsVmExecutorService call, so Jenkins will still crash. Probably need to escalate to a Thread.stop in such a case.

            jglick Jesse Glick
            vexdev Luca Vitucci
            Votes:
            4 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: