[JIRA] (JENKINS-61389) Pipeline Matrix return a "Method code too large!" on a really short pipeline

14 views
Skip to first unread message

kuisathaverat@gmail.com (JIRA)

unread,
Mar 9, 2020, 7:00:06 AM3/9/20
to jenkinsc...@googlegroups.com
Ivan Fernandez Calvo created an issue
 
Jenkins / Bug JENKINS-61389
Pipeline Matrix return a "Method code too large!" on a really short pipeline
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline, pipeline-model-definition-plugin, workflow-cps-plugin
Created: 2020-03-09 10:59
Environment: Jenkins core 2.204
Declarative Pipeline 1.5.1
Priority: Major Major
Reporter: Ivan Fernandez Calvo

The following pipeline causes a "Method code too large!" error when you try to execute it, seems related to the environment variables and the number of axis but I dunno why.

11:51:01  org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
11:51:01  General error during class generation: Method code too large!
11:51:01  
11:51:01  java.lang.RuntimeException: Method code too large!
11:51:01  	at groovyjarjarasm.asm.MethodWriter.a(Unknown Source)
11:51:01  	at groovyjarjarasm.asm.ClassWriter.toByteArray(Unknown Source)
11:51:01  	at org.codehaus.groovy.control.CompilationUnit$17.call(CompilationUnit.java:827)
11:51:01  	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065)
11:51:01  	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
11:51:01  	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
11:51:01  	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
11:51:01  	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
11:51:01  	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
11:51:01  	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
11:51:01  	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
11:51:01  	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
11:51:01  	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
11:51:01  	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
11:51:01  	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
11:51:01  	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:327)
11:51:01  	at hudson.model.ResourceController.execute(ResourceController.java:97)
11:51:01  	at hudson.model.Executor.run(Executor.java:428)
11:51:01  
11:51:01  1 error
11:51:01  
11:51:01  	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
11:51:01  	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
11:51:01  	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
11:51:01  	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
11:51:01  	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
11:51:01  	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
11:51:01  	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
11:51:01  	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
11:51:01  	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
11:51:01  	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
11:51:01  	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
11:51:01  	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
11:51:01  	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
11:51:01  	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:327)
11:51:01  	at hudson.model.ResourceController.execute(ResourceController.java:97)
11:51:01  	at hudson.model.Executor.run(Executor.java:428)
11:51:01  Finished: FAILURE
#!/usr/bin/env groovy

pipeline {
  agent { label 'linux' }
  stages {
    stage('Tests'){
      matrix {
        agent { label 'linux' }
        environment {
          TMPDIR = "/tmp"
          REUSE_CONTAINERS = "true"
          HOME = "/tmp"
          CONFIG_HOME = "/tmp"
          EC_WS ="/tmp/aaaa"
          VENV = "/tmp/.venv"
          PATH = "/tmp/aaaa/.ci/scripts:/tmp/bin:aaaa/bin:aaaa/.ci/scripts:${env.PATH}"
          CLUSTER_CONFIG_FILE="aaaaa/tests/environments/elastic_cloud.yml"
          ENABLE_ES_DUMP = "true"
        }
        axes {
          axis {
              name 'TEST'
              values 'all', 'dotnet', 'go', 'java', 'nodejs', 'python', 'ruby', 'rum'
          }
          axis {
              name 'ELASTIC_STACK_VERSION'
              values '8.0.0-SNAPSHOT', '7.7.0-SNAPSHOT', '7.6.1-SNAPSHOT', '6.8.7-SNAPSHOT'
          }
        }
        stages {
          stage('Prepare Test'){
            steps {
              echo "Running tests - ${ELASTIC_STACK_VERSION} x ${TEST}"
            }
          }
        }
      }
    }
  }
}

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

kuisathaverat@gmail.com (JIRA)

unread,
Apr 15, 2020, 12:22:02 PM4/15/20
to jenkinsc...@googlegroups.com
Ivan Fernandez Calvo commented on Bug JENKINS-61389
 
Re: Pipeline Matrix return a "Method code too large!" on a really short pipeline

Another case that does not make any sense that it said that the method is too large, the following pipeline return the "Method code too large!" error

pipeline {
  agent { label 'ubuntu && immutable' }
  environment {
    BASE_DIR = 'src/github.com/elastic/beats'
    JOB_GCS_BUCKET = 'beats-ci-artifacts'
    JOB_GCS_CREDENTIALS = 'beats-ci-gcs-plugin'
    DOCKERELASTIC_SECRET = 'secret/observability-team/ci/docker-registry/prod'
    DOCKER_REGISTRY = 'docker.elastic.co'
    SNAPSHOT = "true"
  }
  options {
    timeout(time: 3, unit: 'HOURS')
    buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20', daysToKeepStr: '30'))
    timestamps()
    ansiColor('xterm')
    disableResume()
    durabilityHint('PERFORMANCE_OPTIMIZED')
    disableConcurrentBuilds()
  }
  triggers {
    issueCommentTrigger('(?i)^\\/packaging$')
  }
  parameters {
    booleanParam(name: 'macos', defaultValue: false, description: 'Allow macOS stages.')
    booleanParam(name: 'linux', defaultValue: true, description: 'Allow linux stages.')
  }
  stages {
    stage('Checkout') {
      options { skipDefaultCheckout() }
      steps {
        deleteDir()
        gitCheckout(basedir: "${BASE_DIR}")
        setEnvVar("GO_VERSION", readFile("${BASE_DIR}/.go-version").trim())
        stash allowEmpty: true, name: 'source', useDefaultExcludes: false
      }
    }
    stage('Build Packages'){
      matrix {
        agent { label 'ubuntu && immutable' }
        axes {
          axis {
            name 'PLATFORMS'
            values (
              '+linux/armv7',
              '+linux/ppc64le',
              '+linux/s390x',
              '+linux/mips64',
              '+darwin',
              '+windows/386',
              '+windows/amd64'
            )
          }
          axis {
            name 'BEATS_FOLDER'
            values (
              'auditbeat',
              'filebeat',
              'heartbeat',
              'journalbeat',
              'metricbeat',
              'packetbeat',
              'winlogbeat',
              'x-pack/auditbeat',
              'x-pack/filebeat',
              'x-pack/functionbeat',
              'x-pack/heartbeat',
              'x-pack/journalbeat',
              'x-pack/metricbeat',
              'x-pack/packetbeat',
              'x-pack/winlogbeat'
            )
          }
        }
        stages {
          stage('Package'){
            options { skipDefaultCheckout() }
            environment {
              HOME = "${env.WORKSPACE}"
            }
            steps {
              echo "Running tests"
            }
          }
        }
      }
    }
  }
}

moving the agent request from the matrix to the stage resolves the issue, but it should be supported

pipeline {
  agent { label 'ubuntu && immutable' }
  environment {
    BASE_DIR = 'src/github.com/elastic/beats'
    JOB_GCS_BUCKET = 'beats-ci-artifacts'
    JOB_GCS_CREDENTIALS = 'beats-ci-gcs-plugin'
    DOCKERELASTIC_SECRET = 'secret/observability-team/ci/docker-registry/prod'
    DOCKER_REGISTRY = 'docker.elastic.co'
    SNAPSHOT = "true"
  }
  options {
    timeout(time: 3, unit: 'HOURS')
    buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20', daysToKeepStr: '30'))
    timestamps()
    ansiColor('xterm')
    disableResume()
    durabilityHint('PERFORMANCE_OPTIMIZED')
    disableConcurrentBuilds()
  }
  triggers {
    issueCommentTrigger('(?i)^\\/packaging$')
  }
  parameters {
    booleanParam(name: 'macos', defaultValue: false, description: 'Allow macOS stages.')
    booleanParam(name: 'linux', defaultValue: true, description: 'Allow linux stages.')
  }
  stages {
    stage('Checkout') {
      options { skipDefaultCheckout() }
      steps {
        deleteDir()
        gitCheckout(basedir: "${BASE_DIR}")
        setEnvVar("GO_VERSION", readFile("${BASE_DIR}/.go-version").trim())
        stash allowEmpty: true, name: 'source', useDefaultExcludes: false
      }
    }
    stage('Build Packages'){
      matrix {
        axes {
          axis {
            name 'PLATFORMS'
            values (
              '+linux/armv7',
              '+linux/ppc64le',
              '+linux/s390x',
              '+linux/mips64',
              '+darwin',
              '+windows/386',
              '+windows/amd64'
            )
          }
          axis {
            name 'BEATS_FOLDER'
            values (
              'auditbeat',
              'filebeat',
              'heartbeat',
              'journalbeat',
              'metricbeat',
              'packetbeat',
              'winlogbeat',
              'x-pack/auditbeat',
              'x-pack/filebeat',
              'x-pack/functionbeat',
              'x-pack/heartbeat',
              'x-pack/journalbeat',
              'x-pack/metricbeat',
              'x-pack/packetbeat',
              'x-pack/winlogbeat'
            )
          }
        }
        stages {
          stage('Package'){
            agent { label 'ubuntu && immutable' }
            options { skipDefaultCheckout() }
            environment {
              HOME = "${env.WORKSPACE}"
            }
            steps {
              deleteDir()
              unstash 'source'
              release()
              publishPackages()
            }
          }
        }
      }
    }
  }
}

kuisathaverat@gmail.com (JIRA)

unread,
Apr 15, 2020, 12:24:03 PM4/15/20
to jenkinsc...@googlegroups.com
Another case that does not make any sense that it said that the method is too large, the following pipeline return the "Method code too large!" error

{code}

pipeline {
  agent { label 'ubuntu && immutable' }
  environment {
    BASE_DIR = 'src/github.com/elastic/beats'
    JOB_GCS_BUCKET = ' beats-ci-artifacts bucket '
    JOB_GCS_CREDENTIALS = '
beats-ci-gcs-plugin creds '
    DOCKERELASTIC_SECRET = 'secret
/observability-team/ci/docker-registry/prod '
    DOCKER_REGISTRY = 'docker.
elastic example . co com '
{code}



moving the agent request from the matrix to the stage resolves the issue, but it should be supported

{code}

pipeline {
  agent { label 'ubuntu && immutable' }
  environment {
    BASE_DIR = 'src/github.com/elastic/beats'
    JOB_GCS_BUCKET = ' beats-ci-artifacts bucket '
    JOB_GCS_CREDENTIALS = '
beats-ci-gcs-plugin creds '
    DOCKERELASTIC_SECRET = 'secret
/observability-team/ci/docker-registry/prod '
    DOCKER_REGISTRY = 'docker.
elastic example . co com '
{code}

kuisathaverat@gmail.com (JIRA)

unread,
Apr 15, 2020, 12:25:04 PM4/15/20
to jenkinsc...@googlegroups.com
Another case that does not make any sense that it said that the method is too large, the following pipeline return the "Method code too large!" error

{code}
pipeline {
  agent { label 'ubuntu && immutable' }
  environment {
    BASE_DIR = 'src/github.com/elastic/beats'
    JOB_GCS_BUCKET = 'bucket'
    JOB_GCS_CREDENTIALS = 'creds'
    DOCKERELASTIC_SECRET = 'secret'
    DOCKER_REGISTRY = 'docker.example.com'
    JOB_GCS_BUCKET = 'bucket'
    JOB_GCS_CREDENTIALS = 'creds'
    DOCKERELASTIC_SECRET = 'secret'
    DOCKER_REGISTRY = 'docker.example.com'
              deleteDir()               echo "Running tests"
              unstash 'source'
              release()
              publishPackages()
            }
          }
        }
      }
    }
  }
}
{code}

kuisathaverat@gmail.com (JIRA)

unread,
Apr 15, 2020, 12:27:03 PM4/15/20
to jenkinsc...@googlegroups.com
  parameters {
    booleanParam(name: 'macos', defaultValue: false, description: 'Allow macOS
stages .')
{
    stage('
Checkout') {
Build Packages'){
  parameters {
    booleanParam(name: 'macos', defaultValue: false, description: 'Allow macOS
stages .')
{
    stage('
Checkout') {
Build Packages'){
              echo "Running tests"
            }
          }
        }
      }
    }
  }
}
{code}
Reply all
Reply to author
Forward
0 new messages