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

Pipeline job using P4 failing with NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • p4-plugin
    • Jenkins ver. 2.73.3
      P4 Plugin ver. 1.8.12

      I created a very simple pipeline job to test polling without a sync (preview only mode) and it is failing with the below error:

      P4 Task: failed: java.lang.NullPointerException
      

      There is no exception logged in the Jenkins log. The exception seemed to occur on the slave, so I checked the swarm log and nothing was found.

      Here is the pipeline script:

      pipeline {
          agent {
              label "CentOS6"
          }
          
          stages {
              stage("Init") {
                  steps {
                      checkout perforce(
                          credential: 'p4-hbase-build', 
                          populate: previewOnly(quiet: true), 
                          workspace: manualSpec(
                              charset: 'none', 
                              name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', 
                              pinHost: false, 
                              spec: clientSpec(
                                  allwrite: false, 
                                  backup: false, 
                                  clobber: true, 
                                  compress: false, 
                                  line: 'LOCAL', 
                                  locked: false, 
                                  modtime: false, 
                                  rmdir: false, 
                                  serverID: '', 
                                  streamName: '', 
                                  type: 'WRITABLE', 
                                  view: '//sandbox/hdara/test/... //jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}/...'
                              )
                          )
                      )
                  }
              }
              
              stage("Run") {
                  steps {
                      echo "INFO: Running..."
                      sh "export"
                  }
              }
          }
      }
      

      Here is the job console output:

      Started by user Hari Krishna Dara
      Running in Durability level: MAX_SURVIVABILITY
      [Pipeline] node
      Running on slave-a6209140 in /home/jenkins/workspace/test
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (Init)
      [Pipeline] checkout
      ... p4 client -o jenkins-slave-a6209140-test-0 +
      ... p4 info +
      ... p4 client -o jenkins-slave-a6209140-test-0 +
      ... p4 info +
      ... p4 info +
      ... p4 client -i +
      ... client: jenkins-slave-a6209140-test-0
      ... p4 client -o jenkins-slave-a6209140-test-0 +
      ... p4 info +
      ... p4 counter change +
      ... p4 changes -m1 -ssubmitted //jenkins-slave-a6209140-t___ +
      Building on Node: slave-a6209140
      ... p4 client -o jenkins-slave-a6209140-test-0 +
      ... p4 info +
      
      P4 Task: establishing connection.
      ... server: p4proxy-rep:1999
      ... node: slave
      
      P4 Task: attempt: 1
      P4 Task: failed: java.lang.NullPointerException
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Run)
      Stage "Run" skipped due to earlier failure(s)
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: P4 Task: failed: java.lang.NullPointerException
      Finished: FAILURE
      

      I tried to capture the NPE by starting swarm JVM in debug mode and put a breakpoint via jdb. Here is the stacktrace:

        [1] org.jenkinsci.plugins.p4.client.ClientHelper.tidyWorkspace (ClientHelper.java:449)
        [2] org.jenkinsci.plugins.p4.tasks.CheckoutTask.task (CheckoutTask.java:143)
        [3] org.jenkinsci.plugins.p4.tasks.AbstractTask.tryTask (AbstractTask.java:211)
        [4] org.jenkinsci.plugins.p4.tasks.CheckoutTask.invoke (CheckoutTask.java:137)
        [5] org.jenkinsci.plugins.p4.tasks.CheckoutTask.invoke (CheckoutTask.java:30)
        [6] hudson.FilePath$FileCallableWrapper.call (FilePath.java:2,750)
        [7] hudson.remoting.UserRequest.perform (UserRequest.java:153)
        [8] hudson.remoting.UserRequest.perform (UserRequest.java:50)
        [9] hudson.remoting.Request$2.run (Request.java:336)
        [10] hudson.remoting.InterceptingExecutorService$1.call (InterceptingExecutorService.java:68)
        [11] java.util.concurrent.FutureTask.run (FutureTask.java:266)
        [12] java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1,142)
        [13] java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617)
        [14] hudson.remoting.Engine$1$1.run (Engine.java:94)
        [15] java.lang.Thread.run (Thread.java:745)
      

      Looks like iclient is null as seen in the below jdb output:

      pool-1-thread-11 for JNLP4-connect connection to slave/10.253.229.26:5000 id=239[1] print iclient
       iclient = null
      pool-1-thread-11 for JNLP4-connect connection to slave/10.253.229.26:5000 id=239[1] print connection
       connection = "com.perforce.p4java.impl.mapbased.rpc.OneShotServerImpl@104446f1"
      pool-1-thread-11 for JNLP4-connect connection to slave/10.253.229.26:5000 id=239[1] print connection.getClient("jenkins-slave-a6209140-test-0")
       connection.getClient("jenkins-slave-a6209140-test-0") = null
      pool-1-thread-11 for JNLP4-connect connection to slave/10.253.229.26:5000 id=239[1] print connection.getClass().getName()
       connection.getClass().getName() = "com.perforce.p4java.impl.mapbased.rpc.OneShotServerImpl"
      pool-1-thread-11 for JNLP4-connect connection to slave/10.253.229.26:5000 id=239[1] print connection.getClientName()
       connection.getClientName() = null
      pool-1-thread-11 for JNLP4-connect connection to slave/10.253.229.26:5000 id=239[1] print connection.getServerHostPort()
       connection.getServerHostPort() = "p4proxy-rep:1999"
      pool-1-thread-11 for JNLP4-connect connection to slave/10.253.229.26:5000 id=239[1] print connection.getAuthTicket("build")
       connection.getAuthTicket("build") = "FG9435026878130GD728FD8E02A77DD2"
      

            p4karl Karl Wirth
            haridsv Hari Dara
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: