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

Jenkins2, P4 Plugin: ERROR: P4: Task Exception: Unexpected release2 message in protocol dispatcher when using multiple View Mapping

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • p4-plugin
    • OS: Ubuntu 18.04
      JDK 1.8.0_181
      P4 Plugin v
      Jenkins v2.222.3
      P4 Plugin v1.10.12
      Jenkins master in container (image: jenkins/jenkins:2.222.3)
      Jenkin slaves in container (image: jenkins/jnlp-slave:3.27-1)

      ERROR: P4: Task Exception: Unexpected release2 message in protocol dispatcher when using multiple View Mapping

      Testing jenkins upgrade from v1.651 to v2.222.3 on a P4 job with multiple View Mapping.

      On jenkins v.1651 multiple View Mapping works with the following:

      //depot/kernel/05.00/... //ci-kernel-5.0/...
      -//depot/kernel/05.00/sna/... //ci-kernel-5.0/sna/...
      -//depot/kernel/05.00/proactor/... //ci-kernel-5.0/proactor/...
      -//depot/kernel/05.00/spm/... //ci-kernel-5.0/spm/...
      -//depot/kernel/05.00/ws/mox/... //ci-kernel-5.0/ws/mox/...

      On jenkins2 v 2.222.3 with  the following view mapping for P4 Plugin v1.10.12

      //depot/kernel/05.00/... //${P4_CLIENT}/...
      //depot/kernel/05.00/sna/... //${P4_CLIENT}/...
      //depot/kernel/05.00/proactor/... //${P4_CLIENT}/...
      //depot/kernel/05.00/spm/... //${P4_CLIENT}/...
      //depot/kernel/05.00/ws/mox/... //${P4_CLIENT}/...
      

      Get the following:

      Date 2020/05/20 19:41:44:Date 2020/05/20 19:41:44:Operation: flush2SSL receive failed.read: socket: Connection timed out
      P4: Unable to setup workspace: com.perforce.p4java.exception.ConnectionException: Unexpected release2 message in protocol dispatcher at com.perforce.p4java.impl.mapbased.rpc.packet.RpcPacketDispatcher.dispatch(RpcPacketDispatcher.java:225) at com.perforce.p4java.impl.mapbased.rpc.OneShotServerImpl.execMapCmdList(OneShotServerImpl.java:363) at com.perforce.p4java.impl.mapbased.rpc.OneShotServerImpl.execMapCmdList(OneShotServerImpl.java:203) at com.perforce.p4java.impl.mapbased.server.cmd.BaseDelegator.execMapCmdList(BaseDelegator.java:138) at com.perforce.p4java.impl.mapbased.server.cmd.ClientDelegator.getClient(ClientDelegator.java:62) at com.perforce.p4java.impl.mapbased.server.Server.getClient(Server.java:1394) at org.jenkinsci.plugins.p4.client.ClientHelper.updateClient(ClientHelper.java:176) at org.jenkinsci.plugins.p4.client.ClientHelper.clientLogin(ClientHelper.java:160) at org.jenkinsci.plugins.p4.client.ClientHelper.<init>(ClientHelper.java:100) at org.jenkinsci.plugins.p4.tasks.AbstractTask.tryTask(AbstractTask.java:166) at org.jenkinsci.plugins.p4.tasks.CheckoutTask.invoke(CheckoutTask.java:157) at org.jenkinsci.plugins.p4.tasks.CheckoutTask.invoke(CheckoutTask.java:32) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3069) at hudson.remoting.UserRequest.perform(UserRequest.java:211) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:369) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:117) at java.lang.Thread.run(Thread.java:748)Caused by: com.perforce.p4java.exception.ProtocolError: Unexpected release2 message in protocol dispatcher at com.perforce.p4java.impl.mapbased.rpc.func.proto.ProtocolFunctionDispatcher.dispatch(ProtocolFunctionDispatcher.java:110) at com.perforce.p4java.impl.mapbased.rpc.packet.RpcPacketDispatcher.dispatch(RpcPacketDispatcher.java:189) ... 21 more
      ERROR: P4: Task Exception: Unexpected release2 message in protocol dispatcher
      

       

       

       

       

       

       

          [JENKINS-62373] Jenkins2, P4 Plugin: ERROR: P4: Task Exception: Unexpected release2 message in protocol dispatcher when using multiple View Mapping

          Karl Wirth added a comment -

          Hi drodspike,

          Strange that's an SSL communication error not a P4-Plugin error. Usually these are because of network problems.

          A couple of things. First on my SSL environement that workspace definition with v1.10.12 works OK.  From my console output:

          ... p4 client -i +
          ...   View: -
                //depot/kernel/05.00/... //jenkins-dockervm-0008gvn12kcyg-JENKINS-62373-MultiLineClient-0/...
                //depot/kernel/05.00/sna/... //jenkins-dockervm-0008gvn12kcyg-JENKINS-62373-MultiLineClient-0/...
                //depot/kernel/05.00/proactor/... //jenkins-dockervm-0008gvn12kcyg-JENKINS-62373-MultiLineClient-0/...
                //depot/kernel/05.00/spm/... //jenkins-dockervm-0008gvn12kcyg-JENKINS-62373-MultiLineClient-0/...
                //depot/kernel/05.00/ws/mox/... //jenkins-dockervm-0008gvn12kcyg-JENKINS-62373-MultiLineClient-0/...
          ...   Root: /home/jenkins/workspace/JENKINS-62373-MultiLineClient
          
          ---cut---
          
          P4 Task: syncing files at change: 205301
          ... p4 sync -q /home/jenkins/workspace/JENKINS-62373-MultiLineClient/...@205301 -p4 sync -q /home/jenkins/workspace/JENKINS-62373-MultiLineClient/...@205301
          
          ... totalFileSize 45
          ... totalFileCount 1
          

          NOTE: You probably know this already but the basic multiline mapping above will only get you the contents of "//depot/kernel/05.00/ws/mox/..." so its not really a valid mapping but is OK for testing.

          Next a couple of questions:

          (1) Is this a new job? If not please try creating a new job with the same mapping. Does that also fail?

          (2) What happens if you log onto the Jenkins machine, install a copy of P4 and then try to manually create the same workspace using the same P4USER that Jenkins uses. Does it work or do you get an error back (possibly related to triggers)?

          (3) Do any jobs work from this slave?

          (4) What happens if you make the client spec smaller (for example only first two lines). Does it work?

          (5) What happens if you run the build on the Jenkins master?

          (6) Where is this error? Console log or polling log?

           

          If none of those work, please get me the following:

          (1) Screenshots of the job definition.

          (2) Jenkinsfile if it's a pipeline job.

          (3) Polling log (if relevant).

          (4) Full console log for the job.

          (5) Output from 'p4 -Ztag info'.

          Note: As some of this information is confidential it can also be sent to 'support@perforce.com' if you prefer.

          Karl Wirth added a comment - Hi drodspike , Strange that's an SSL communication error not a P4-Plugin error. Usually these are because of network problems. A couple of things. First on my SSL environement that workspace definition with v1.10.12 works OK.  From my console output: ... p4 client -i + ... View: - //depot/kernel/05.00/... //jenkins-dockervm-0008gvn12kcyg-JENKINS-62373-MultiLineClient-0/... //depot/kernel/05.00/sna/... //jenkins-dockervm-0008gvn12kcyg-JENKINS-62373-MultiLineClient-0/... //depot/kernel/05.00/proactor/... //jenkins-dockervm-0008gvn12kcyg-JENKINS-62373-MultiLineClient-0/... //depot/kernel/05.00/spm/... //jenkins-dockervm-0008gvn12kcyg-JENKINS-62373-MultiLineClient-0/... //depot/kernel/05.00/ws/mox/... //jenkins-dockervm-0008gvn12kcyg-JENKINS-62373-MultiLineClient-0/... ... Root: /home/jenkins/workspace/JENKINS-62373-MultiLineClient ---cut--- P4 Task: syncing files at change: 205301 ... p4 sync -q /home/jenkins/workspace/JENKINS-62373-MultiLineClient/...@205301 -p4 sync -q /home/jenkins/workspace/JENKINS-62373-MultiLineClient/...@205301 ... totalFileSize 45 ... totalFileCount 1 NOTE : You probably know this already but the basic multiline mapping above will only get you the contents of "//depot/kernel/05.00/ws/mox/..." so its not really a valid mapping but is OK for testing. Next a couple of questions: (1) Is this a new job? If not please try creating a new job with the same mapping. Does that also fail? (2) What happens if you log onto the Jenkins machine, install a copy of P4 and then try to manually create the same workspace using the same P4USER that Jenkins uses. Does it work or do you get an error back (possibly related to triggers)? (3) Do any jobs work from this slave? (4) What happens if you make the client spec smaller (for example only first two lines). Does it work? (5) What happens if you run the build on the Jenkins master? (6) Where is this error? Console log or polling log?   If none of those work, please get me the following: (1) Screenshots of the job definition. (2) Jenkinsfile if it's a pipeline job. (3) Polling log (if relevant). (4) Full console log for the job. (5) Output from 'p4 -Ztag info'. Note : As some of this information is confidential it can also be sent to 'support@perforce.com' if you prefer.

          David Rodriguez added a comment - - edited

          HI Karl,

          When I changed the multi-line view  mapping and NOT use the env var ${P4_CLIENT},  it passed  (reference TO: below).  So I think ${P4_CLIENT} variable doesn't work in a multi-line view mapping scenario.   Also, I used the same mapping that was used in jenkins 1.651  which uses the "-" after the first line.

          FROM:

          Workspace name: ${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}
          
          View Mappings:
          
          //depot/kernel/05.00/... //${P4_CLIENT}/... 
          //depot/kernel/05.00/sna/... //${P4_CLIENT}/... 
          //depot/kernel/05.00/proactor/... //${P4_CLIENT}/... 
          //depot/kernel/05.00/spm/... //${P4_CLIENT}/... 
          //depot/kernel/05.00/ws/mox/... //${P4_CLIENT}/...

          TO:

          Workspace name:  ci-kernel-5.0
          
          View Mappings:
          
          //depot/kernel/05.00/... //ci-kernel-5.0/...
          -//depot/kernel/05.00/sna/... //ci-kernel-5.0/sna/...
          -//depot/kernel/05.00/proactor/... //ci-kernel-5.0/proactor/...
          -//depot/kernel/05.00/spm/... //ci-kernel-5.0/spm/...
          -//depot/kernel/05.00/ws/mox/... //ci-kernel-5.0/ws/mox/...
          

           

          David Rodriguez added a comment - - edited HI Karl, When I changed the multi-line view  mapping and NOT use the env var ${P4_CLIENT},  it passed  (reference  TO : below).  So I think ${P4_CLIENT} variable doesn't work in a multi-line view mapping scenario.   Also, I used the same mapping that was used in jenkins 1.651  which uses the "-" after the first line. FROM: Workspace name: ${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER} View Mappings: //depot/kernel/05.00/... //${P4_CLIENT}/... //depot/kernel/05.00/sna/... //${P4_CLIENT}/... //depot/kernel/05.00/proactor/... //${P4_CLIENT}/... //depot/kernel/05.00/spm/... //${P4_CLIENT}/... //depot/kernel/05.00/ws/mox/... //${P4_CLIENT}/... TO: Workspace name: ci-kernel-5.0 View Mappings: //depot/kernel/05.00/... //ci-kernel-5.0/... - //depot/kernel/05.00/sna/... //ci-kernel-5.0/sna/... - //depot/kernel/05.00/proactor/... //ci-kernel-5.0/proactor/... - //depot/kernel/05.00/spm/... //ci-kernel-5.0/spm/... - //depot/kernel/05.00/ws/mox/... //ci-kernel-5.0/ws/mox/...  

          Karl Wirth added a comment - - edited

          Hi drodspike

          EDIT: I sent you the instructions below but did some more testing and in one case got inconsistent results. A multiline view with P4_CLIENT does work in my env (see below) but on an old job I have edited a lot it does not work at all! Please create a 100% new job and add the P4_CLIENT the view and try it. If that still does not work please see my response below.

           

          Thanks. In my test above I was using '${P4_CLIENT}' in your multiline definition which worked on Master, Windows slave and docker linux slave. So its not something as simple as multiline doesnt work with '${P4_CLIENT}'. It must be the way you are using the mapping or something environmental.

          I admit my workspace name was "Jenkins-${NODE_NAME}${JOB_NAME}${EXECUTOR_NUMBER}" so I just tested again without "jenkins-" and still all working

          Therefore to help me investigate please get me

          (1) Screenshots of the job definition.

          (2) Jenkinsfile if it's a pipeline job.

          (3) Polling log (if relevant).

          (4) Full console log for the job.

          (5) Output from 'p4 -Ztag info'.

          Note: As mentioned some of this information is confidential it can also be sent to 'support@perforce.com' if you prefer.

           

           

          Karl Wirth added a comment - - edited Hi drodspike EDIT: I sent you the instructions below but did some more testing and in one case got inconsistent results. A multiline view with P4_CLIENT does work in my env (see below) but on an old job I have edited a lot it does not work at all! Please create a 100% new job and add the P4_CLIENT the view and try it. If that still does not work please see my response below.   Thanks. In my test above I was using '${P4_CLIENT}' in your multiline definition which worked on Master, Windows slave and docker linux slave. So its not something as simple as multiline doesnt work with '${P4_CLIENT}'. It must be the way you are using the mapping or something environmental. I admit my workspace name was "Jenkins-${NODE_NAME} ${JOB_NAME} ${EXECUTOR_NUMBER}" so I just tested again without "jenkins-" and still all working Therefore to help me investigate please get me (1) Screenshots of the job definition. (2) Jenkinsfile if it's a pipeline job. (3) Polling log (if relevant). (4) Full console log for the job. (5) Output from 'p4 -Ztag info'. Note : As mentioned some of this information is confidential it can also be sent to 'support@perforce.com' if you prefer.    

          David Rodriguez added a comment - - edited

          Karl, 

          I'm new to Perforce. What is the correct syntax for multi-line view mapping to user? Also, I'll be on vacation next week and return on Jun 1,2020.  I will perform the steps.

          //depot/kernel/05.00/... //${P4_CLIENT}/...
          -//depot/kernel/05.00/sna/... //${P4_CLIENT}/...
          -//depot/kernel/05.00/proactor/... //${P4_CLIENT}/...
          -//depot/kernel/05.00/spm/... //${P4_CLIENT}/...
          -//depot/kernel/05.00/ws/mox/... //${P4_CLIENT}/...
          
          or 
          
          //depot/kernel/05.00/... //${P4_CLIENT}/...
          //depot/kernel/05.00/sna/... //${P4_CLIENT}/...
          //depot/kernel/05.00/proactor/... //${P4_CLIENT}/...
          //depot/kernel/05.00/spm/... //${P4_CLIENT}/...
          //depot/kernel/05.00/ws/mox/... //${P4_CLIENT}/...
          

          David Rodriguez added a comment - - edited Karl,  I'm new to Perforce. What is the correct syntax for multi-line view mapping to user? Also, I'll be on vacation next week and return on Jun 1,2020.  I will perform the steps. //depot/kernel/05.00/... //${P4_CLIENT}/... - //depot/kernel/05.00/sna/... //${P4_CLIENT}/... - //depot/kernel/05.00/proactor/... //${P4_CLIENT}/... - //depot/kernel/05.00/spm/... //${P4_CLIENT}/... - //depot/kernel/05.00/ws/mox/... //${P4_CLIENT}/... or //depot/kernel/05.00/... //${P4_CLIENT}/... //depot/kernel/05.00/sna/... //${P4_CLIENT}/... //depot/kernel/05.00/proactor/... //${P4_CLIENT}/... //depot/kernel/05.00/spm/... //${P4_CLIENT}/... //depot/kernel/05.00/ws/mox/... //${P4_CLIENT}/...

          Karl Wirth added a comment -

          Hi drodspike - Sorry for the delay. Been on vacation.

          You can find some examples of using our workspace mappings here:

               https://www.perforce.com/manuals/p4guide/Content/P4Guide/configuration.workspace_view.html

           

          For your examples the top one is a good mapping and probably the one you want. It says give me "//depot/kernel/05.00/..." but then exclude the directories on lines that start with "-". For example dont sync anything under "//depot/kernel/05.00/sna/..." and "//depot/kernel/05.00/proactor/...". However if it was me writing it I would make the right hand side match the left hand side (not essential but just a convention for readability):
          //depot/kernel/05.00/... //${P4_CLIENT}/...//depot/kernel/05.00/sna/... //${P4_CLIENT}/sna/...//depot/kernel/05.00/proactor/... //${P4_CLIENT}/proactor/...//depot/kernel/05.00/spm/... //${P4_CLIENT}/spm/...//depot/kernel/05.00/ws/mox/... //${P4_CLIENT}/ws/mox/...
          These exclussionary mappings are discussed here:

                https://www.perforce.com/manuals/p4guide/Content/P4Guide/configuration.workspace_view.exclude.html

           

          The second option you provide is a bad mapping because following lines are in the same workspace location as previous lines so override them. For example in your example above only "//depot/kernel/05.00/ws/max..." will be synced. All lines after the first are also redundant because "..." is the Perforce wildcard for all files in this directory and all directories under this point. Therefore if you are syncing "//depot/kernel/05.00/..." you will also get "//depot/kernel/05.00/ws/max..." etc.

          The following document shows an example where your second mapping may have made sense because you are changing the location of files in the workspace:

              https://www.perforce.com/manuals/p4guide/Content/P4Guide/configuration.workspace_view.mapping.html

          For example say I want to put everything under '05.00' into a directoy called 'Code' on my disk except I want to put 'sna' in a different directory:
          //depot/kernel/05.00/... //${P4_CLIENT}/Code/....//depot/kernel/05.00/sna/... //${P4_CLIENT}/MyNewDirectory/sna...
          The reasons you would want to reorganize files in this way is usually to suit an IDE or new build environment that mandates a different direcory structure.

            

           

          Karl Wirth added a comment - Hi drodspike - Sorry for the delay. Been on vacation. You can find some examples of using our workspace mappings here:      https://www.perforce.com/manuals/p4guide/Content/P4Guide/configuration.workspace_view.html   For your examples the top one is a good mapping and probably the one you want. It says give me "//depot/kernel/05.00/..." but then exclude the directories on lines that start with "-". For example dont sync anything under "//depot/kernel/05.00/sna/..." and "//depot/kernel/05.00/proactor/...". However if it was me writing it I would make the right hand side match the left hand side (not essential but just a convention for readability): //depot/kernel/05.00/... //${P4_CLIENT}/... //depot/kernel/05.00/sna/... //${P4_CLIENT}/sna/... //depot/kernel/05.00/proactor/... //${P4_CLIENT}/proactor/... //depot/kernel/05.00/spm/... //${P4_CLIENT}/spm/... //depot/kernel/05.00/ws/mox/... //${P4_CLIENT}/ws/mox/... These exclussionary mappings are discussed here:       https://www.perforce.com/manuals/p4guide/Content/P4Guide/configuration.workspace_view.exclude.html   The second option you provide is a bad mapping because following lines are in the same workspace location as previous lines so override them. For example in your example above only "//depot/kernel/05.00/ws/max..." will be synced. All lines after the first are also redundant because "..." is the Perforce wildcard for all files in this directory and all directories under this point. Therefore if you are syncing "//depot/kernel/05.00/..." you will also get "//depot/kernel/05.00/ws/max..." etc. The following document shows an example where your second mapping may have made sense because you are changing the location of files in the workspace:     https://www.perforce.com/manuals/p4guide/Content/P4Guide/configuration.workspace_view.mapping.html For example say I want to put everything under '05.00' into a directoy called 'Code' on my disk except I want to put 'sna' in a different directory: //depot/kernel/05.00/... //${P4_CLIENT}/Code/....//depot/kernel/05.00/sna/... //${P4_CLIENT}/MyNewDirectory/sna... The reasons you would want to reorganize files in this way is usually to suit an IDE or new build environment that mandates a different direcory structure.     

          Hi Karl, after your explanation that the "dash" is used to exclude directories from mapping.  I reconfigured the job as follows using env var "${P4_CLIENT}.  It worked fine.

          //depot/kernel/05.00/... ///...
          -//depot/kernel/05.00/sna/... //${P4_CLIENT}/sna/...
          -//depot/kernel/05.00/proactor/... //${P4_CLIENT}/proactor/...
          -//depot/kernel/05.00/spm/... //${P4_CLIENT}/spm/...
          -//depot/kernel/05.00/ws/mox/... //${P4_CLIENT}/ws/mox/...
          
          

          So as for me, this issue is resolved unless you want me to try something else.

          David Rodriguez added a comment - Hi Karl, after your explanation that the "dash" is used to exclude directories from mapping.  I reconfigured the job as follows using env var "${P4_CLIENT}.  It worked fine. //depot/kernel/05.00/... ///... - //depot/kernel/05.00/sna/... //${P4_CLIENT}/sna/... - //depot/kernel/05.00/proactor/... //${P4_CLIENT}/proactor/... - //depot/kernel/05.00/spm/... //${P4_CLIENT}/spm/... - //depot/kernel/05.00/ws/mox/... //${P4_CLIENT}/ws/mox/... So as for me, this issue is resolved unless you want me to try something else.

          I do have a question, regarding upgrade of a jenkins v1.65  p4 job (plugin="perforce@1.3.35")  to jenkins v2.222.3. (plugin="p4@1.10.12") . When I did the initial upgrade of the jenkins p4 jobs,   Source Code Management configuration for the p4 jobs were set to "none".   Is this expected behavior requiring the p4 jobs to be manually re-configured for perforce Software?

          David Rodriguez added a comment - I do have a question, regarding upgrade of a jenkins v1.65  p4 job (plugin="perforce@1.3.35")  to jenkins v2.222.3. (plugin="p4@1.10.12") . When I did the initial upgrade of the jenkins p4 jobs,   Source Code Management configuration for the p4 jobs were set to "none".   Is this expected behavior requiring the p4 jobs to be manually re-configured for perforce Software?

          Karl Wirth added a comment -

          Hi drodspike - You are the second person to report this. Jenkins have changed their credential storage slightly so the credentials need to be readded. I have a meeting with the Dev's later this month so will see what we can do. At minimum I think we should warn users in the release notes and docs.

          Karl Wirth added a comment - Hi drodspike - You are the second person to report this. Jenkins have changed their credential storage slightly so the credentials need to be readded. I have a meeting with the Dev's later this month so will see what we can do. At minimum I think we should warn users in the release notes and docs.

          Thank you Karl!

          David Rodriguez added a comment - Thank you Karl!

            p4karl Karl Wirth
            drodspike David Rodriguez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: