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

StackOverflowError in CpsTransformer running Declarative on JVMs with small -Xss in workflow-cps 2.33

      With the last update of Pipeline plugins of today, a crash occurs just after the SCM step with the crash. See the joined file for the stack.

        1. pluginlist.xml
          7 kB
        2. stack.txt
          78 kB
        3. visited-lines
          166 kB

          [JENKINS-44578] StackOverflowError in CpsTransformer running Declarative on JVMs with small -Xss in workflow-cps 2.33

          Jesse Glick added a comment -

          Ha! Reproduced on a default installation in Windows 10. So it does look to be platform-specific, though I have no clue why the platform would matter for this code. Will try to diagnose better.

          Jesse Glick added a comment - Ha! Reproduced on a default installation in Windows 10. So it does look to be platform-specific, though I have no clue why the platform would matter for this code. Will try to diagnose better.

          Jesse Glick added a comment -

          Reproduces with minimal Declarative (but not scripted)

          pipeline {
              agent any
              stages {
                  stage('x') {
                      steps {
                          echo 'OK'
                      }
                  }
              }
          }
          

          with only Pipeline: Model Definition and its dependencies enabled. Next, to check whether functional tests reproduce it when run on Windows.

          Jesse Glick added a comment - Reproduces with minimal Declarative (but not scripted) pipeline { agent any stages { stage( 'x' ) { steps { echo 'OK' } } } } with only Pipeline: Model Definition and its dependencies enabled. Next, to check whether functional tests reproduce it when run on Windows.

          Jesse Glick added a comment -

          Hard to say. The tests are not generally runnable on Windows it seems abayer. I did run some representative ones which did not attempt to run sh steps or whatever, and they passed. There appear to be no tests in acceptance-test-harness using Declarative.

          Jesse Glick added a comment - Hard to say. The tests are not generally runnable on Windows it seems abayer . I did run some representative ones which did not attempt to run sh steps or whatever, and they passed. There appear to be no tests in acceptance-test-harness using Declarative.

          Jesse Glick added a comment -

          Hmm, can reproduce in Windows 10 using java -jar jenkins.war using JDK 8u66 (that bundled in the Windows installer currently) but not 8u131. Yet irish_paul claims to have seen this with 8u131. Are you sure Jenkins was really running that? Check /systemInfo. And note that the Windows installer apparently ignores the currently installed JDK.

          I am going to check whether this problem is reproducible using obsolete JDK versions on Linux.

          Jesse Glick added a comment - Hmm, can reproduce in Windows 10 using  java -jar jenkins.war  using JDK 8u66 (that bundled in the Windows installer currently) but not 8u131. Yet irish_paul claims to have seen this with 8u131. Are you sure Jenkins was really running that? Check /systemInfo . And note that the Windows installer apparently ignores the currently installed JDK. I am going to check whether this problem is reproducible using obsolete JDK versions on Linux.

          Jesse Glick added a comment - - edited

          Unfortunately I cannot reproduce on Linux even using 8u66, which does not support the hypothesis that this is purely a matter of a bug in some obsolete Java builds.

          Jesse Glick added a comment - - edited Unfortunately I cannot reproduce on Linux even using 8u66, which does not support the hypothesis that this is purely a matter of a bug in some obsolete Java builds.

          Jesse Glick added a comment -

          And on Windows it only fails when using the JRE bundled in the installer. Not using a downloaded JDK 8u66. ??

          Jesse Glick added a comment - And on Windows it only fails when using the JRE bundled in the installer. Not using a downloaded JDK 8u66. ??

          Jesse Glick added a comment -

          Apparently because the bundled JRE is a 32-bit client JVM whereas I had downloaded a 64-bit server JVM. If I download the 32-bit JDK for Windows I can see the failure.

          Finally I can see the error on Linux, using JDK 8u66 in a 32-bit download (though not passing -client, so using the server JVM). Yet a 32-bit 8u131 is fine, and when I go back to the 32-bit 8u66 it works too. So perhaps it occurs only under some nondeterministic conditions.

          Jesse Glick added a comment - Apparently because the bundled JRE is a 32-bit client JVM whereas I had downloaded a 64-bit server JVM. If I download the 32-bit JDK for Windows I can see the failure. Finally I can see the error on Linux, using JDK 8u66 in a 32-bit download (though not passing -client , so using the server JVM). Yet a 32-bit 8u131 is fine, and when I go back to the 32-bit 8u66 it works too. So perhaps it occurs only under some nondeterministic conditions.

          Jesse Glick added a comment -

          Attaching list of calls being made to CpsTransformer.visit(ASTNode). Does not really look like an infinite loop of any kind; just like a lot of recursion, which sometimes bombs out. Indeed when I run on the 32-bit Windows JRE but add -Xss4m it works. So I think the changes made in 2.33 just used deeper calls than before, and on JVMs with small defaults from ergonomics, that was the frame that broke the camel’s stack.

          Jesse Glick added a comment - Attaching list of calls being made to CpsTransformer.visit(ASTNode) . Does not really look like an infinite loop of any kind; just like a lot of recursion, which sometimes bombs out. Indeed when I run on the 32-bit Windows JRE but add -Xss4m it works. So I think the changes made in 2.33 just used deeper calls than before, and on JVMs with small defaults from ergonomics, that was the frame that broke the camel’s stack.

          Jesse Glick added a comment -

          abayer so it looks like it exploded somewhere around here. Just look at that indentation!

          Jesse Glick added a comment - abayer so it looks like it exploded somewhere around here . Just look at that indentation!

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          http://jenkins-ci.org/commit/workflow-cps-plugin/0595328fc0ba6fc8743ea67937c6da2386156d6e
          Log:
          Merge pull request #140 from jglick/StackOverflowError-JENKINS-44578

          JENKINS-44578 Use native CpsTransformer

          Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/875d2bc36582...0595328fc0ba

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml http://jenkins-ci.org/commit/workflow-cps-plugin/0595328fc0ba6fc8743ea67937c6da2386156d6e Log: Merge pull request #140 from jglick/StackOverflowError- JENKINS-44578 JENKINS-44578 Use native CpsTransformer Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/875d2bc36582...0595328fc0ba

            jglick Jesse Glick
            edtech Ed Ed
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: