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

Pipeline job using P4 failing with NPE

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Component/s: p4-plugin
    • Labels:
    • Environment:
      Jenkins ver. 2.73.3
      P4 Plugin ver. 1.8.12
    • Similar Issues:

      Description

      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"
      

        Attachments

          Activity

          Hide
          p4paul Paul Allen added a comment -

          Thank you for the output:

          lbr.replication readonly 

          Your admin might have setup a legacy 'Build farm' server; for modern CI systems like Jenkins a Commit-edge server would a better alternative.  Please refer to the note in:

          https://www.perforce.com/perforce/doc.current/manuals/p4dist/index.html#P4Dist/DB5-72814.html

          Officially the p4-plugin does not support 'Build farm' servers, however there is a limited configuration that a few customers have found to work. 

          Show
          p4paul Paul Allen added a comment - Thank you for the output: lbr.replication readonly Your admin might have setup a legacy 'Build farm' server; for modern CI systems like Jenkins a Commit-edge server would a better alternative.  Please refer to the note in: https://www.perforce.com/perforce/doc.current/manuals/p4dist/index.html#P4Dist/DB5-72814.html Officially the p4-plugin does not support 'Build farm' servers, however there is a limited configuration that a few customers have found to work. 
          Hide
          haridsv Hari Dara added a comment -

          We recently migrated to Edge framework, so not sure why it would appear as a legacy build farm. I will check with the SCM admins if this could be a configuration issue.

          Show
          haridsv Hari Dara added a comment - We recently migrated to Edge framework, so not sure why it would appear as a legacy build farm. I will check with the SCM admins if this could be a configuration issue.
          Hide
          p4karl Karl Wirth added a comment -

          Hi Hari Dara. Is this solved now or still a problem?

          Show
          p4karl Karl Wirth added a comment - Hi Hari Dara . Is this solved now or still a problem?
          Hide
          haridsv Hari Dara added a comment -

          I have not had to face this issue for a while since I got an alternative p4 proxy that didn't cause this NPE. If this issue is too specific and is very unlikely to occur for other users, you may just close it.

          Show
          haridsv Hari Dara added a comment - I have not had to face this issue for a while since I got an alternative p4 proxy that didn't cause this NPE. If this issue is too specific and is very unlikely to occur for other users, you may just close it.
          Hide
          p4karl Karl Wirth added a comment -

          Hi Hari Dara, Thanks. However if this problem reoccurs please let us know and we will open a support ticket.

          Show
          p4karl Karl Wirth added a comment - Hi Hari Dara , Thanks. However if this problem reoccurs please let us know and we will open a support ticket.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: