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

Cannot get property 'script' on null object

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • Centos 5.10 x86_64, standalone installation
      Jenkins ver. 2.53
      pipeline-model-definition 1.1.2
      workflow-job 2.10
      workflow-cps 2.29

      We have the following pipeline definition:

      #!groovy
      
      pipeline {
          agent {
              label 'Solaris'
          }
      
          options {
              buildDiscarder(logRotator(numToKeepStr: '10'))
              disableConcurrentBuilds()
          }
      
          parameters {
              string(name: 'BRANCH', defaultValue: 'master', description: 'Git branch to use for the build.')
              choice(name: 'APPEND_COMMIT_VERSION', choices: 'ON\nOFF', description: 'Append Git commit ID to build version?')
              choice(name: 'DEBUG_SQL', choices: '0\n1\n2', description: 'Level of SQL tracing.\n0 - disabled.')
              choice(name: 'SAP_CONNECTION_POOL_DEBUG', choices: '0\n1', description: 'Level of SAP connection pool tracing.\nWorks only in debug builds.\n0 - disabled.')
              choice(name: 'BUILD_TYPE', choices: 'RelWithDebInfo\nDebug\nRelease', description: 'Build type')
          }
      
          environment {
              BUILD_DIR = 'build'
          }
      
          stages {
              stage('build') {
                  steps {
                      sh '''
                          mkdir -p $BUILD_DIR
      
                          rm -f ${BUILD_DIR}/*.zip
      
                          PATH=${PATH}:/opt/csw/i386-pc-solaris2.10/bin/     # we need objcopy for packaging
      
                          CFLAGS=-m64
                          CXXFLAGS=-m64
                          LDFLAGS=-m64
                          CC=/opt/csw/bin/gcc
                          CXX=/opt/csw/bin/g++
                          export CFLAGS CXXFLAGS LDFLAGS CC CXX
      
                          cmake -GNinja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DTEST_THREADS_COUNT=2 -DAPPEND_COMMIT_VERSION=${APPEND_COMMIT_VERSION} -DDEBUG_SQL=${DEBUG_SQL} -DSAP_CONNECTION_POOL_DEBUG=${SAP_CONNECTION_POOL_DEBUG} -H. -B${BUILD_DIR}
      
                          cmake --build ${BUILD_DIR} --target package
                      '''
      
                      archive "${BUILD_DIR}/*.zip"
                  }
              }
              stage('unit-test') {
                  steps {
                      sh '''
                          find ${BUILD_DIR}/src/Test -name test_detail.xml | xargs rm -f
      
                          GTEST_OUTPUT=xml cmake --build ${BUILD_DIR} --target check || true
                      '''
      
                      junit "${BUILD_DIR}/src/Test/*/test_detail.xml"
                  }
              }
          }
      }

      It sometimes works and sometimes (most of the time actually) not and we get:

      java.lang.NullPointerException: Cannot get property 'script' on null object
      	at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:60)
      	at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:174)
      	at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:47)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
      	at org.jenkinsci.plugins.pipeline.modeldefinition.parser.Converter.parseFromWorkflowRun(Converter.groovy:207)
      	at org.jenkinsci.plugins.pipeline.modeldefinition.parser.Converter$parseFromWorkflowRun.call(Unknown Source)
      	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils.attachDeclarativeActions(Utils.groovy:214)
      	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils$attachDeclarativeActions$6.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:18)
      	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/var/lib/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:66)
      	at WorkflowScript.run(WorkflowScript:3)
      	at ___cps.transform___(Native Method)
      	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
      	at sun.reflect.GeneratedMethodAccessor355.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:483)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
      	at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
      	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
      	at sun.reflect.GeneratedMethodAccessor359.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:483)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
      	at com.cloudbees.groovy.cps.Next.step(Next.java:74)
      	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
      	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:165)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:328)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:80)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:240)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:228)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)

      Sometimes we get it to build by restarting the build several times until it goes through but in most cases we have to leave it be.
      This particular build executes on Solaris 10. We use very similar pipelines for our linux and windows builds (actually only build commands differ). The issue is also present there but manifests itself rarely.

            abayer Andrew Bayer
            jzakrzewski Jakub Zakrzewski
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: