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

Agent time out with P4Groovy sync after 5 minutes?

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: In Progress (View Workflow)
    • Priority: Trivial
    • Resolution: Unresolved
    • Component/s: p4-plugin
    • Labels:
    • Environment:
      1.10.0 P4Plugin
      2.176.1 (Cloudbees)
    • Similar Issues:

      Description

      When using 'p4.run("sync","//PATH/...") the Windows 10 slave drops the connection after 5 minutes every time. This was proven on a Webex using Wireshark.

      If 'p4sync()' is used the command ran to completion (20 minutes). Potentially there is a problem with P4Groovy commands not displaying any output till the end of the command that is triggering this problem.

      This ticket has been created to record the occurrence, allow me to try and reproduce the problem and to be a place holder where other reports of the same problem can be recorded.

      Note: Cloudbees support were unable to find a problem on their side.

       

      Example jenkinsfile (in editor):

      pipeline{
          agent{
              label 'Win10'
          }
          stages{
              stage('P4 Sync'){
                  steps{
                      script{
                          def p4 = p4 credential: 'MasterCredential', workspace: manualSpec(charset: 'utf8', name: 'CLIENT', pinHost: false, spec: clientSpec(allwrite: true, backup: false, clobber: false, compress: false, line: 'WIN', locked: false, modtime: false, rmdir: false, streamName: '', type: 'WRITABLE', view: '//depot/... //CLIENT/...'))
                          p4.run("sync","-f", "//depot/PATH/...#0")
                          p4.run("sync","-f", "//depot/PATH/...")
                      }
                  }
              }
          }
      }
      

        Attachments

          Issue Links

            Activity

            Hide
            boczar Alexander Boczar added a comment -

            I'm running into this variation when running P4Groovy:

            It times out after 30 seconds if there's no output because of this hard-coded beauty:

             

            https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/Request.java:171

              // wait until the response arrives
            t.setName(name+" / waiting for "channel.getName()" id="+id);
            while(response==null && !channel.isInClosed())
            // I don't know exactly when this can happen, as pendingCalls are cleaned up by Channel,
            // but in production I've observed that in rare occasion it can block forever, even after a channel
            // is gone. So be defensive against that.
            wait(30*1000);

            if (response==null)
            // channel is closed and we still don't have a response
            throw new RequestAbortedException(null);

            Show
            boczar Alexander Boczar added a comment - I'm running into this variation when running P4Groovy: It times out after 30 seconds if there's no output because of this hard-coded beauty:   https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/Request.java :171   // wait until the response arrives t.setName(name+" / waiting for " channel.getName() " id="+id); while(response==null && !channel.isInClosed()) // I don't know exactly when this can happen, as pendingCalls are cleaned up by Channel, // but in production I've observed that in rare occasion it can block forever, even after a channel // is gone. So be defensive against that. wait(30*1000); if (response==null) // channel is closed and we still don't have a response throw new RequestAbortedException(null);
            Hide
            jonhurtado Jonathan Hurtado added a comment - - edited

            I wanted to add that this issue also occurs when running a p4groovy.run integrate command.

            > def integrateResults = perforce.run("integ""-c${changeListNum{color}}""//${SOURCE_BRANCH{color}}/...""//${TARGET_BRANCH{color}}/...")

            The merge lasts longer than 5 minutes because there are so many files to integrate, and, as a result, the build process is aborted.

            If we can change that hard-coded timeout to a setting that we can modify, that would be ideal.  Until then, my current workaround is to call a bat script that calls p4 integ.

            Show
            jonhurtado Jonathan Hurtado added a comment - - edited I wanted to add that this issue also occurs when running a p4groovy.run integrate command. > def  integrateResults = perforce.run( "integ" ,  "-c ${ changeListNum{color}}" ,  "// ${ SOURCE_BRANCH{color}}/..." ,  "// ${ TARGET_BRANCH{color}}/..." ) The merge lasts longer than 5 minutes because there are so many files to integrate, and, as a result, the build process is aborted. If we can change that hard-coded timeout to a setting that we can modify, that would be ideal.  Until then, my current workaround is to call a bat script that calls p4 integ.
            Hide
            emanuel_may Emanuel May added a comment -

            Hello,

            We also run into this timeout problem when using p4.run with longer-running commands, like merge, integrate, reconcile or submit. Right now we are forced to use the command line for those cases. We would prefer to use p4.run though, as we get easier to parse return objects from the api.

            Thanks!

            Show
            emanuel_may Emanuel May added a comment - Hello, We also run into this timeout problem when using p4.run with longer-running commands, like merge, integrate, reconcile or submit. Right now we are forced to use the command line for those cases. We would prefer to use p4.run though, as we get easier to parse return objects from the api. Thanks!
            Hide
            p4paul Paul Allen added a comment -

            An advanced setting in the Credential sets a 'tick' interval to print out a 'waiting' message to the log during long running commands. The value needs to be less than 30,000ms to avoid Jenkins automatic disconnect. Default value is 0, which disables the tick message.

            https://github.com/jenkinsci/p4-plugin/commit/5ad18cf7746fb47e58e842ddb3d7b023d5463735

            Show
            p4paul Paul Allen added a comment - An advanced setting in the Credential sets a 'tick' interval to print out a 'waiting' message to the log during long running commands. The value needs to be less than 30,000ms to avoid Jenkins automatic disconnect. Default value is 0, which disables the tick message. https://github.com/jenkinsci/p4-plugin/commit/5ad18cf7746fb47e58e842ddb3d7b023d5463735

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              p4karl Karl Wirth
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated: