• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • p4-plugin

      After a recent Perforce Server upgrade I am receiving the following errors

      ERROR: P4: Unable to initialise CheckoutTask: com.perforce.p4java.exception.RequestException: Client '<client>' can only be used from host '<host>'.

      In my pipeline the failure occurs around

          [Stage] (p4):cmd:... p4 repos -C
          [Stage] p4 repos -C
          [Stage] 
          [Stage] Client '<client>' can only be used from host '<host>'.
          [Stage] 
          [Stage] (p4):stop:8
          [Stage] P4: Unable to initialise CheckoutTask: com.perforce.p4java.exception.RequestException: Client '<client>' can only be used from host '<host>'.
      

      Comparing successfully completed jobs prior to the p4 server upgrade I believe the problem is caused when the P4 plugin attempts to Initialise Graph commit changes within a block that depends on the version being 2017.1 or higher CheckoutTask.java Line 109.

      Looking through the jenkins logs I can see multiple severe failures

      10-Jul-2017 00:26:03.328 INFO [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.p4.tasks.CheckoutTask.getBuildChange getBuildChange:return:2095934
      10-Jul-2017 00:26:03.336 SEVERE [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.p4.tasks.CheckoutTask.initialise P4: Unable to initialise CheckoutTask: com.perforce.p4java.exception.RequestException: Client 'jenkins-node_jobname_jenkins' can only be used from host 'jenkins-node'.
      10-Jul-2017 00:26:14.056 INFO [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.p4.tasks.CheckoutTask.getBuildChange getBuildChange:return:2095934
      10-Jul-2017 00:26:14.096 SEVERE [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.p4.tasks.CheckoutTask.initialise P4: Unable to initialise CheckoutTask: com.perforce.p4java.exception.RequestException: Client 'jenkins-node_jobname_jenkins' can only be used from host 'jenkins-node'.
      10-Jul-2017 00:26:24.632 INFO [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.p4.tasks.CheckoutTask.getBuildChange getBuildChange:return:2095934
      10-Jul-2017 00:26:24.675 SEVERE [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.p4.tasks.CheckoutTask.initialise P4: Unable to initialise CheckoutTask: com.perforce.p4java.exception.RequestException: Client 'jenkins-node_jobname_jenkins' can only be used from host 'jenkins-node'.
      10-Jul-2017 00:26:34.908 INFO [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.p4.tasks.CheckoutTask.getBuildChange getBuildChange:return:2095934
      10-Jul-2017 00:26:34.915 SEVERE [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.p4.tasks.CheckoutTask.initialise P4: Unable to initialise CheckoutTask: com.perforce.p4java.exception.RequestException: Client 'jenkins-node_jobname_jenkins' can only be used from host 'jenkins-node'.
      10-Jul-2017 00:26:45.136 INFO [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.p4.tasks.CheckoutTask.getBuildChange getBuildChange:return:2095934
      10-Jul-2017 00:26:45.143 SEVERE [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.p4.tasks.CheckoutTask.initialise P4: Unable to initialise CheckoutTask: com.perforce.p4java.exception.RequestException: Client 'jenkins-node_jobname_jenkins' can only be used from host 'jenkins-node'.
      10-Jul-2017 00:26:45.148 INFO [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.statsd.StatsdListener.onCompleted StatsdListener: config: org.jenkinsci.plugins.statsd.StatsdConfig@176215f7
      10-Jul-2017 00:26:45.148 INFO [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.statsd.StatsdListener.onCompleted StatsdListener: job: jobname, result: FAILURE, duration: 42057, metricName: jenkins.jobname.FAILURE
      10-Jul-2017 00:26:45.179 INFO [Executor #0 for jenkins-node : executing jobname #38010] org.jenkinsci.plugins.adaptivedisonnector.FailureListener.onFinalized Monitoring jenkins-node after failed run of jobname #3801
      

      A current workaround has been created to bypass the P4 Plugin and use the cli instead.

      Any help would be greatly appreciated!

          [JENKINS-45420] P4: Unable to initialise CheckoutTask

          My first thought is to try/catch and ignore the failure of getting the graph heads for the repository - our pipeline was working in an earlier version of perforce and this appears to adding to the builds so may not necessarily be required.

          Andrew Hammett added a comment - My first thought is to try/catch and ignore the failure of getting the graph heads for the repository - our pipeline was working in an earlier version of perforce and this appears to adding to the builds so may not necessarily be required.

          Rob Petti added a comment -

          perforce-plugin and p4-plugin are different plugins, the former of which doesn't support pipeline at all. I've updated the component on the ticket to p4-plugin, since that seems to be the one you are using.

          Can you also please update the "Environment" field on this ticket to include the version of "P4 Plugin" you are using instead of "Perforce Plugin"?

          Rob Petti added a comment - perforce-plugin and p4-plugin are different plugins, the former of which doesn't support pipeline at all. I've updated the component on the ticket to p4-plugin, since that seems to be the one you are using. Can you also please update the "Environment" field on this ticket to include the version of "P4 Plugin" you are using instead of "Perforce Plugin"?

          PR raised with above suggestion https://github.com/jenkinsci/p4-plugin/pull/48

          Andrew Hammett added a comment - PR raised with above suggestion https://github.com/jenkinsci/p4-plugin/pull/48

          rpetti thank you and sorry for the confusion. ticket updated

          Andrew Hammett added a comment - rpetti thank you and sorry for the confusion. ticket updated

          Paul Allen added a comment -

          Thank you for the PR; I would like to know the cause of the exception and avoid it (rather than catching it and ignoring it).

          I have not been able to reproduce the issue; what server version are you using (17.1 I assume) and do you have any repos?
          Perhaps it's a permission issue for the Jenkins user? I agree that we need to protect/trap the issue, I just wanted to be more precise.

          Paul Allen added a comment - Thank you for the PR; I would like to know the cause of the exception and avoid it (rather than catching it and ignoring it). I have not been able to reproduce the issue; what server version are you using (17.1 I assume) and do you have any repos? Perhaps it's a permission issue for the Jenkins user? I agree that we need to protect/trap the issue, I just wanted to be more precise.

          Code changed in jenkins
          User: Paul Allen
          Path:
          src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java
          src/main/java/org/jenkinsci/plugins/p4/scm/P4ChangeRequestSCMHead.java
          http://jenkins-ci.org/commit/p4-plugin/26e810a1c4c42cc1e5edaa6b2337e2509873b31f
          Log:
          Return empty list on error for listRepos()

          JENKINS-45420

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java src/main/java/org/jenkinsci/plugins/p4/scm/P4ChangeRequestSCMHead.java http://jenkins-ci.org/commit/p4-plugin/26e810a1c4c42cc1e5edaa6b2337e2509873b31f Log: Return empty list on error for listRepos() JENKINS-45420

          Hi p4paul, thank you for taking a look and the fix.

          For reference, I'm running Server Version 2017.1 - P4D/LINUX26X86_64/2017.1/1511680 (2017/05/05)

          From the cli, p4 repos returns an empty string. I don't believe we're running any graph repos - if we are I don't have access to them.

          I agree that this could be a permissions issue but I wouldn't expect that to fail the checkout task - instead silently continue, which it looks like you've done.

          Thank you!

          Andrew Hammett added a comment - Hi p4paul , thank you for taking a look and the fix. For reference, I'm running Server Version 2017.1 - P4D/LINUX26X86_64/2017.1/1511680 (2017/05/05) From the cli, p4 repos returns an empty string. I don't believe we're running any graph repos - if we are I don't have access to them. I agree that this could be a permissions issue but I wouldn't expect that to fail the checkout task - instead silently continue, which it looks like you've done. Thank you!

          Paul Allen added a comment -

          Released patch in 1.7.2 (please reopen if not resolved)

          Paul Allen added a comment - Released patch in 1.7.2 (please reopen if not resolved)

            p4paul Paul Allen
            ahammett Andrew Hammett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: