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

System Groovy - Unable to cast to AbstractBuild

      We just upgraded our Jenkins version from "1.424.6" "1.447.1".

      After the upgrade, all system groovy scripts that contained the following line stopped working:
      AbstractBuild g_currentBuild = (AbstractBuild)Thread.currentThread().executable;

      When this line in the script is executed, the following stacktrace was generated:
      FATAL: null
      java.lang.StackOverflowError
      at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:178)
      at org.codehaus.groovy.ast.ClassNode.equals(ClassNode.java:677)
      at org.codehaus.groovy.ast.ClassNode.genericTypeAsString(ClassNode.java:1149)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1127)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1132)
      at org.codehaus.groovy.ast.ClassNode.genericTypeAsString(ClassNode.java:1152)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1127)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1132)
      at org.codehaus.groovy.ast.ClassNode.genericTypeAsString(ClassNode.java:1152)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1127)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1132)
      at org.codehaus.groovy.ast.ClassNode.genericTypeAsString(ClassNode.java:1152)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1127)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1132)
      at org.codehaus.groovy.ast.ClassNode.genericTypeAsString(ClassNode.java:1152)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1127)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1132)
      at org.codehaus.groovy.ast.ClassNode.genericTypeAsString(ClassNode.java:1152)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1127)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1132)
      at org.codehaus.groovy.ast.ClassNode.genericTypeAsString(ClassNode.java:1152)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1127)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1132)
      at org.codehaus.groovy.ast.ClassNode.genericTypeAsString(ClassNode.java:1152)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1127)
      at org.codehaus.groovy.ast.ClassNode.toString(ClassNode.java:1132)
      [...repeats until stack overflow.]

      We upgraded our Groovy plugin to the latest version (1.12) with the same result.

      We rolled back to Jenkins 1.424.6 and we do not see the error there.

          [JENKINS-14044] System Groovy - Unable to cast to AbstractBuild

          vimil added a comment -

          I got the same error, but I when I changed the groovy code to
          AbstractBuild g_currentBuild = Thread.currentThread().executable;

          the error went away.
          Not sure if this is a bug with groovy 1.8.5. This was tested with jenkins 1.515

          vimil added a comment - I got the same error, but I when I changed the groovy code to AbstractBuild g_currentBuild = Thread.currentThread().executable; the error went away. Not sure if this is a bug with groovy 1.8.5. This was tested with jenkins 1.515

            vjuranek vjuranek
            adf2112 Anthony Ferrari
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: