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

Declarative pipeline "Method too large" after removing stage

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • None
    • Jenkins 2.479.3
      pipeline-model-definition 2.2255.v56a_15e805f12

      Note: this is not "Method code too large" but "Method too large".

      We've had this "big" declarative pipeline (~1800 LoC).
      We've added stages, removed stages, added functions, etc...
      We do not use shared libraries.

      We also have the `SCRIPT_SPLITTING_TRANSFORMATION` enabled (true) and the `...LOCAL_VARIABLES` disabled (false by default), although we don't have variables declared outside (or inside) the pipeline.

      Most of the stages are in the form of

      stage("Name") {
        agent { stuff }
        steps {
          sh "stuff"
        }
        when {
          stuff
        }
      }

      And most of them are grouped inside parallel stages.

      For professional reasons, I can't disclose the full pipeline.

       

      Now, we removed a stage from the Jenkinsfile (as it was not needed/wanted anymore) and we started hitting this exception

      General error during class generation: Method too large: WorkflowScript.___cps___146115 ()Lcom/cloudbees/groovy/cps/impl/CpsFunction;
       
      groovyjarjarasm.asm.MethodTooLargeException: Method too large: WorkflowScript.___cps___146115 ()Lcom/cloudbees/groovy/cps/impl/CpsFunction;
          at groovyjarjarasm.asm.MethodWriter.computeMethodInfoSize(MethodWriter.java:2087)
          at groovyjarjarasm.asm.ClassWriter.toByteArray(ClassWriter.java:447) 
      (...)

       

      I did some tests and the error appears after, at least, removing the `when` clause in the stage.
      (Removing the whole stage also causes the problem).

      I'm guessing this is a gray area between the `groupSize`/`declarationGroupSize` and the actual method sizes.

      Given the different error message and slightly different stack trace, I couldn't tell if it was the same problem as JENKINS-37984 or JENKINS-56500.

            Unassigned Unassigned
            tiago_teixeira_erx Tiago
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: