Strange matrix build issue, always fails when number of executor is more than one

Hi,

I have successfully setup a project using a jenkins pipeline. The build-process is run on an windows-10-based-agent, host#1. The agent can utilize up to 4 executors in parallel on host#1 and runs like a charm. The build-agent is setup as a windows service, so it is started automatically in the background host#1.

I now cloned that setup of the build-agent to host#2. The windows service is setup and runs. The build-agent is used, as I disabled the agent on host#1. I started the agent utilizing only one executor. The pipeline runs successfully. As soon as I start to increase the number of executor, the pipeline step that compile the c-based software always fails with very strange syntax-based errors. As soon as I decrease the number of executors to one and restart the pipeline everything works again smoothly.

I expierence this problem on two machines now. The build uses a custom workspace for the matrix build so everything should be in it’s own directory on the agent. I can verify that this is the case on all build-hosts.

Here is my pipeline setup:

#!/usr/bin/env groovy

pipeline {
  agent any

  options {
    // don't checkout before every stage
    skipDefaultCheckout(true)
    skipStagesAfterUnstable()
    // keep 10 most recent builds
    buildDiscarder(logRotator(numToKeepStr: '10'))
  }

  environment {
    ORGANIZATION = ''
    MAIN_PROJECT = ''
    BRANCH = ''
  }

  stages {
    stage('Prepare environment') {
      steps {
        
        script {
          ORGANIZATION = "${env.JOB_NAME}".tokenize('/')[0]
          MAIN_PROJECT = "${env.JOB_NAME}".tokenize('/')[1]
          BRANCH = "${env.JOB_NAME}".tokenize('/')[2]
        }

        echo "ORGANIZATION: ${ORGANIZATION}"
        echo "MAIN_PROJECT: ${MAIN_PROJECT}"
        echo "BRANCH: ${BRANCH}"
      }
    }

    stage('Clean') {
        steps {
            script {
                echo "Cleaning up old build artifacts"
                deleteDir()
            }
        }
    }

    stage('Build & Test') {
      failFast true

      matrix {
        axes {
          axis {
            name 'PRODUCT'
            values 'A'
          }

          axis {
            name 'TARGET'
            values 'Release', 'Prototype', 'Endurance', 'Debug', 'Simulator'
          }
        }

        stages {
          stage('Matrix Build & Test') {
            agent {
              node {
                label 'Compiler'
                customWorkspace "${env.WORKSPACE}\\..\\${ORGANIZATION}\\${BRANCH}\\${PRODUCT}\\${TARGET}\\${MAIN_PROJECT}"
              }
            }

            steps {
              checkout scm

              bat (
                label: "Compile with compiler for ${PRODUCT}:${TARGET}",
                script: "${env.WORKSPACE}\\cfg\\compile\\call_compiler.bat"
              )

              script {
                if ("${TARGET}" == "Release") {
                  bat (
                    label: "Static Analysis with PC-Lint against MISRA-C:2012 for ${PRODUCT}:${TARGET}",
                    script: "${env.WORKSPACE}\\cfg\\lint\\call_linter.bat"
                  )

                  ISSUES_PCLINT = scanForIssues (
                    tool: pcLint (pattern: "build/test/static/report.txt")
                  )
                }
              }
            }

            post {
              success {
                // Provided by pipeline-utilty-steps-plugin
                script {
                  zip (
                    archive: true,
                    overwrite: true,
                    glob: "src/*.hex",
                    zipFile: "build/firmware_${PRODUCT}_${TARGET}.zip"
                  )
                }
              }
              
              always {
                script {
                  if ("${TARGET}" == "Release") {
                    script {
                      zip (
                        archive: true,
                        overwrite: true,
                        glob: "build/test/static/report.txt",
                        zipFile: "build/test/static/report_${PRODUCT}_${TARGET}.zip"
                      )
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  post {
    failure {
      echo 'TODO add email notification about failed build.'
    }

    always {
      echo 'TODO add reporting'
      script {
        if (!env.ABORTED && env.BRANCH_NAME == 'main') {
          def issuesToPublish = []
          if (ISSUES_PCLINT) {
            issuesToPublish << ISSUES_PCLINT
          }

          // provided by warnings-ng-plugin
          publishIssues (
            issues : issuesToPublish
          )
        } else {
          def issuesToPublish = []
          if (ISSUES_PCLINT) {
            issuesToPublish << ISSUES_PCLINT
          }
          // provided by warnings-ng-plugin
          publishIssues (
            issues : issuesToPublish
          )
        }
      }
    }
  }
}

Does anyone experience such a problem? Any idea what to look for? Any help really appreciated.