java.lang.RuntimeException: Method code too large!

Jenkins JIRA | Anudeep Lalam | 8 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Hi, We are getting below error in Pipeline which has some 495 lines of groovy code. Initially we assumed that one of our methods has an issue but once we remove any 30-40 lines of Pipeline groovy, this issue is not coming. Can you please suggest a quick workaround. It's a blocker for us. {code} org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: General error during class generation: Method code too large! java.lang.RuntimeException: Method code too large! at groovyjarjarasm.asm.MethodWriter.a(Unknown Source) at groovyjarjarasm.asm.ClassWriter.toByteArray(Unknown Source) at org.codehaus.groovy.control.CompilationUnit$16.call(CompilationUnit.java:815) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688) at groovy.lang.GroovyShell.parse(GroovyShell.java:700) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:67) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:410) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:373) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:213) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) 1 error at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1073) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688) at groovy.lang.GroovyShell.parse(GroovyShell.java:700) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:67) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:410) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:373) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:213) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Finished: FAILURE {code}

    Jenkins JIRA | 8 months ago | Anudeep Lalam
    java.lang.RuntimeException: Method code too large!

    Root Cause Analysis

    1. java.lang.RuntimeException

      Method code too large!

      at groovyjarjarasm.asm.MethodWriter.a()
    2. Groovy
      GroovyShell.parse
      1. groovyjarjarasm.asm.MethodWriter.a(Unknown Source)
      2. groovyjarjarasm.asm.ClassWriter.toByteArray(Unknown Source)
      3. org.codehaus.groovy.control.CompilationUnit$16.call(CompilationUnit.java:815)
      4. org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053)
      5. org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
      6. org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
      7. org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
      8. groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
      9. groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
      10. groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
      11. groovy.lang.GroovyShell.parse(GroovyShell.java:700)
      11 frames
    3. org.jenkinsci.plugins
      WorkflowRun.run
      1. org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:67)
      2. org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:410)
      3. org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:373)
      4. org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:213)
      4 frames
    4. Hudson
      Executor.run
      1. hudson.model.ResourceController.execute(ResourceController.java:98)
      2. hudson.model.Executor.run(Executor.java:410)
      2 frames