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

StackOverFlowException when using matrix jobs

      I am currently trying to set up a matrix build and whenever I have an axis with more than one values I run into a StackOverFlowException.

      This is my Pipeline (declarative):

      Comments:

      • I am not sure if customWorkspace will do what I want, that's currently only a try. Does anybody happen to have an idea how to use external-workspace-plugin from declarative pipelines?
      • the pipeline is edited for removing internal information, thus there might be unexpetced syntax issues
      • My feeling is there is a connection with another step used here like credentials or customworkspace because I can remember I've seen arunning pipeline in the past only with temporary workspaces on every build stage so missing all the checked out code. I'm trying to reproduce this and deliver that information later.
      #!groovy
      pipeline {
          agent 
          {
          	node {
      		    label ''
      		    customWorkspace "${JOB_NAME}/workspace"
      		}		    
      	}
          
          options { timestamps () }
          stages {
              stage('Build') {
              	environment {
      		    BUSY_HOME = "${BUSYDIR}"
      		    BUSY_CMD = "${BUSYDIR}\\myBuildSystem.cmd"                    
      		    CVS_CREDENTIALS = credentials('BuildUser')
      		}
              	matrix {
              	    axes {
              	        axis {
              	            name 'PLATFORM'
              	            values 'win32vc9'        	            
              	        }
              	        axis {
              	            name 'MODULE'
              	            values 'repo1/module1', 'repo2/module1'
              	        }
              	        axis {
              	            name 'VARIANT'
              	            values 'debug'      	            
              	        }
              	    }
              	    stages {
              	        stage( 'Checkout' ) {
      				environment {
      				    BUSY_VARIANT = "${VARIANT}"                    
      				    CVS_REPOSITORY = MODULE.substring( 0, MODULE.indexOf('/') )
      				    CVS_PATH = MODULE.substring( MODULE.indexOf('/') + 1 , MODULE.length() )
      				    CVS_CREDENTIALS = credentials('BuildUser')
      	         		}
      		            	steps {
      								checkout changelog: true, poll: true, scm: [$class: 'CVSSCM', canUseUpdate: true, checkoutCurrentTimestamp: false
                      					, cleanOnFailedUpdate: false, disableCvsQuiet: false, forceCleanCopy: false, legacy: false, pruneEmptyDirectories: true
                          				, repositories: [[compressionLevel: -1, cvsRoot: ":pserver:${CVS_CREDENTIALS_USR}@MYCVS/${CVS_REPOSITORY}", excludedRegions: [[pattern: '']]
                          				, password: "${CVS_CREDENTIALS_PSW}", passwordRequired: true, repositoryItems: [[location: [$class: 'HeadRepositoryLocation']
                          				, modules: [[localName: "${CVS_REPOSITORY}/${CVS_PATH}", remoteName: "${CVS_PATH}"]]]]]], skipChangeLog: false]
                          		}
              	        }
              	        stage( 'Build' ) {
      						environment {
      							BUSY_VARIANT = "${VARIANT}"                    
      							CVS_REPOSITORY = MODULE.substring( 0, MODULE.indexOf('/') )
      							CVS_PATH = MODULE.substring( MODULE.indexOf('/') + 1 , MODULE.length() )
      	         			}
      						steps {
                  				bat """					
      						
      								pushd "${MODULE}"
      								call  %BUSY_CMD% BUSY_ROOT:%WORKSPACE% BUSY_PLATFORM:${PLATFORM} r -e default
      								popd"""
      				                recordIssues enabledForFailure: true, sourceCodeEncoding: 'ISO-8859-1',
                      						healthy: 1,
                          					tools: [ msBuild( id: "${MODULE}_${PLATFORM}_${VARIANT}" ) ]
                          		}
              	        }        	        stage( 'Test' ) {
      						environment {
      							BUSY_VARIANT = "${VARIANT}"                    
      							CVS_REPOSITORY = MODULE.substring( 0, MODULE.indexOf('/') )
      							CVS_PATH = MODULE.substring( MODULE.indexOf('/') + 1 , MODULE.length() )
      	         			}
      						steps {
                  				bat """					
      					
      								pushd "${MODULE}"
      								call  %BUSY_CMD% BUSY_ROOT:%WORKSPACE% BUSY_PLATFORM:${PLATFORM} r -e run-test
      								popd"""
      						}
              	        }
              	    }
              	}
              }
          }
          post {
              always {
                  script {
                      def mailbody = '${SCRIPT, template="groovy_html.template"}'
                      def mailsubject = 'Jenkins Build ' + currentBuild.fullDisplayName + ' finished: ' + currentBuild.currentResult
                      emailext attachLog: false, body: mailbody, recipientProviders: [culprits(), brokenTestsSuspects(), brokenBuildSuspects(), upstreamDevelopers()], subject: mailsubject
                  }
              }
          }
      }
      
      

          [JENKINS-61423] StackOverFlowException when using matrix jobs

          This is the jenkins output:

          Started by user USER
          Lightweight checkout support not available, falling back to full checkout.
          Checking out hudson.scm.CVSSCM into D:\workdir\build\Build-all\workspace@script to read Jenkins/Jenkinsfile-all
          Using locally configured password for connection to :pserver:USER@SERVER:2401/build
          cvs checkout -P -D 11 Mar 2020 08:28:22 +0100 -d Jenkins Jenkins 
          cvs server: Updating Jenkins
          U Jenkins/Jenkinsfile-all
          Using locally configured password for connection to :pserver:USER@SERVER:2401/build
          cvs rlog -S -d10 Mar 2020 22:01:00 +0100<11 Mar 2020 08:28:22 +0100 Jenkins 
          cvs rlog: Logging Jenkins
          Running in Durability level: MAX_SURVIVABILITY
          [Pipeline] Start of Pipeline
          [Pipeline] node
          Running on Jenkins in D:\workdir\build\Build-all\workspace
          [Pipeline] {
          [Pipeline] ws
          Running in D:\workdir\.jenkins\Build-all\workspace
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Declarative: Checkout SCM)
          [Pipeline] checkout
          Using locally configured password for connection to :pserver:USER@SERVER:2401/build
          cvs checkout -P -D 11 Mar 2020 08:28:22 +0100 -d Jenkins Jenkins 
          cvs server: Updating Jenkins
          U Jenkins/Jenkinsfile-all
          Using locally configured password for connection to :pserver:USER@SERVER:2401/build
          cvs rlog -S -d10 Mar 2020 22:01:00 +0100<11 Mar 2020 08:28:22 +0100 Jenkins 
          cvs rlog: Logging Jenkins
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] timestamps
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Build)
          [Pipeline] withCredentials
          08:28:48  Masking supported pattern matches of %CVS_CREDENTIALS% or %CVS_CREDENTIALS_USR% or %CVS_CREDENTIALS_PSW%
          [Pipeline] {
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] parallel
          [Pipeline] { (Branch: Matrix - MODULE = 'repo1/module1')
          [Pipeline] { (Branch: Matrix - MODULE = 'repo2/module1')
          [Pipeline] stage
          [Pipeline] { (Matrix - MODULE = 'repo1/module1')
          [Pipeline] stage
          [Pipeline] { (Matrix - MODULE = 'repo2/module1')
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Checkout)
          [Pipeline] stage
          [Pipeline] { (Checkout)
          [Pipeline] withCredentials
          08:28:48  Masking supported pattern matches of %CVS_CREDENTIALS% or %CVS_CREDENTIALS_USR% or %CVS_CREDENTIALS_PSW%
          [Pipeline] withCredentials
          08:28:49  Masking supported pattern matches of %CVS_CREDENTIALS% or %CVS_CREDENTIALS_USR% or %CVS_CREDENTIALS_PSW%
          [Pipeline] End of Pipeline
          java.lang.StackOverflowError
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:114)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
          [ removed a lot iterations of an endless loop ]
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
          	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
          Finished: FAILURE
          
          

          Christoph Fetzer added a comment - This is the jenkins output: Started by user USER Lightweight checkout support not available, falling back to full checkout. Checking out hudson.scm.CVSSCM into D:\workdir\build\Build-all\workspace@script to read Jenkins/Jenkinsfile-all Using locally configured password for connection to :pserver:USER@SERVER:2401/build cvs checkout -P -D 11 Mar 2020 08:28:22 +0100 -d Jenkins Jenkins cvs server: Updating Jenkins U Jenkins/Jenkinsfile-all Using locally configured password for connection to :pserver:USER@SERVER:2401/build cvs rlog -S -d10 Mar 2020 22:01:00 +0100<11 Mar 2020 08:28:22 +0100 Jenkins cvs rlog: Logging Jenkins Running in Durability level: MAX_SURVIVABILITY [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in D:\workdir\build\Build-all\workspace [Pipeline] { [Pipeline] ws Running in D:\workdir\.jenkins\Build-all\workspace [Pipeline] { [Pipeline] stage [Pipeline] { (Declarative: Checkout SCM) [Pipeline] checkout Using locally configured password for connection to :pserver:USER@SERVER:2401/build cvs checkout -P -D 11 Mar 2020 08:28:22 +0100 -d Jenkins Jenkins cvs server: Updating Jenkins U Jenkins/Jenkinsfile-all Using locally configured password for connection to :pserver:USER@SERVER:2401/build cvs rlog -S -d10 Mar 2020 22:01:00 +0100<11 Mar 2020 08:28:22 +0100 Jenkins cvs rlog: Logging Jenkins [Pipeline] } [Pipeline] // stage [Pipeline] timestamps [Pipeline] { [Pipeline] stage [Pipeline] { (Build) [Pipeline] withCredentials 08:28:48 Masking supported pattern matches of %CVS_CREDENTIALS% or %CVS_CREDENTIALS_USR% or %CVS_CREDENTIALS_PSW% [Pipeline] { [Pipeline] withEnv [Pipeline] { [Pipeline] parallel [Pipeline] { (Branch: Matrix - MODULE = 'repo1/module1' ) [Pipeline] { (Branch: Matrix - MODULE = 'repo2/module1' ) [Pipeline] stage [Pipeline] { (Matrix - MODULE = 'repo1/module1' ) [Pipeline] stage [Pipeline] { (Matrix - MODULE = 'repo2/module1' ) [Pipeline] withEnv [Pipeline] { [Pipeline] withEnv [Pipeline] { [Pipeline] stage [Pipeline] { (Checkout) [Pipeline] stage [Pipeline] { (Checkout) [Pipeline] withCredentials 08:28:48 Masking supported pattern matches of %CVS_CREDENTIALS% or %CVS_CREDENTIALS_USR% or %CVS_CREDENTIALS_PSW% [Pipeline] withCredentials 08:28:49 Masking supported pattern matches of %CVS_CREDENTIALS% or %CVS_CREDENTIALS_USR% or %CVS_CREDENTIALS_PSW% [Pipeline] End of Pipeline java.lang.StackOverflowError at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:114) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082) [ removed a lot iterations of an endless loop ] at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920) Finished: FAILURE

          Christoph Fetzer added a comment - - edited

          OK, I had a 1:1 translation from matrix axis names to the environment with a different name, that caused the trouble. When accessing the axis names directly, everything started to work.

           

          Here the issue:

          matrix {
              axes {
                   axis { 
                       name 'PLATFORM' values 'win32vc9' 
                   }
                   axis { 
                       name 'MODULE' values 'repo1/module1', 'repo2/module1' 
                   }
                   axis { 
                       name 'VARIANT' values 'debug' 
                   }
               }
               stages {
                  stage( 'Checkout' ) 
                  {
                       environment {
                          // removing the next line and accessing the content with %VARIANT% or ${VARIANT} directly or renaming the axis to "BUSY_VARIANT" solved the problem
                          BUSY_VARIANT = "${VARIANT}"
                       }
           ...
          

          I am not sure if this still is a bug or not. Though might be interesting for otherones to be able to find a solution.

          Christoph Fetzer added a comment - - edited OK, I had a 1:1 translation from matrix axis names to the environment with a different name, that caused the trouble. When accessing the axis names directly, everything started to work.   Here the issue: matrix { axes { axis { name 'PLATFORM' values 'win32vc9' } axis { name 'MODULE' values 'repo1/module1' , 'repo2/module1' } axis { name 'VARIANT' values 'debug' } } stages { stage( 'Checkout' ) { environment { // removing the next line and accessing the content with %VARIANT% or ${VARIANT} directly or renaming the axis to "BUSY_VARIANT" solved the problem BUSY_VARIANT = "${VARIANT}" } ... I am not sure if this still is a bug or not. Though might be interesting for otherones to be able to find a solution.

          Hm, there seem to be additional correlations:

          • when I add an environment to another stage looking like this
          stage( 'Build' ) {
              environment {
                  MODULE_PATH = MODULE.replace( "/", "\\");
              }
          }
          
          • when I enable the credentials step again

          the StackOverFlow is back again

           

           

          Christoph Fetzer added a comment - Hm, there seem to be additional correlations: when I add an environment to another stage looking like this stage( 'Build' ) { environment { MODULE_PATH = MODULE.replace( "/" , "\\" ); } } when I enable the credentials step again the StackOverFlow is back again    

            Unassigned Unassigned
            chrisfetz Christoph Fetzer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: