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

Pipeline script bat command hanging in windows 7

      When I run pipeline build process , it hangs for ever .
      my pipeline script
      node

      { stage 'Build' bat 'mvn clean' }

      ------------------------------Console -output ----
      Running on master in %

      {JENKINS_HOME}

      \workspace\Pipeline My CR
      [Pipeline] {
      [Pipeline] stage (Clone SVN Source)
      Using the ‘stage’ step without a block argument is deprecated
      Entering stage Clone SVN Source
      Proceeding
      [Pipeline] svn
      Updating file:///D:/Jenkins_Framework/Project_Repository/trunk/java at revision '2017-01-17T20:13:28.142 +0700'
      At revision 24

      No changes for file:///D:/Jenkins_Framework/Project_Repository/trunk/java since the previous build
      [Pipeline] stage (Build)
      Using the ‘stage’ step without a block argument is deprecated
      Entering stage Build
      Proceeding
      [Pipeline] bat
      [Pipeline My CR] Running batch script
      .........

          [JENKINS-41130] Pipeline script bat command hanging in windows 7

          Jesse Glick added a comment -

          Generally a duplicate, but not much to do here unless there is a known way to reproduce from scratch.

          Jesse Glick added a comment - Generally a duplicate, but not much to do here unless there is a known way to reproduce from scratch.

          I have similar issue (Linux master and Windows slave), I can locally easily reproduce at will if this may help or some run test are needed.

          Jerome Godbout added a comment - I have similar issue (Linux master and Windows slave), I can locally easily reproduce at will if this may help or some run test are needed.

          Jesse Glick added a comment -

          Generally these cases mean that the wrapper cmd process has exited but failed to leave behind an exit status file. If you can reproduce at will, then try to track down why that exit status file is not being written. Probably a lack of handling for some corner case of Windows process management in the wrapper command, which you could reproduce outside Jenkins.

          Note that there is an effort underway to create a Powershell launcher, which would presumably have its own set of bugs, but perhaps not any affecting you.

          Jesse Glick added a comment - Generally these cases mean that the wrapper cmd process has exited but failed to leave behind an exit status file. If you can reproduce at will, then try to track down why that exit status file is not being written. Probably a lack of handling for some corner case of Windows process management in the wrapper command, which you could reproduce outside Jenkins. Note that there is an effort underway to create a Powershell launcher, which would presumably have its own set of bugs, but perhaps not any affecting you.

          Where/How can I monitor this exit status file exactly?

          Can I look somewhere onto the client or server file system? Or do I have to run Jenkins into a debug mode?

          Can you point where this exit status is handled into the Jenkins code so I can have an idea of where to look?

          Thanks

          P.S.: I don't see Powershell as a savior of everything it will come with his set of execution policy and permission nightmare for those kind of thing. I personally would rather have a Python wrapper and do my own subprocess if needed there.

          Jerome Godbout added a comment - Where/How can I monitor this exit status file exactly? Can I look somewhere onto the client or server file system? Or do I have to run Jenkins into a debug mode? Can you point where this exit status is handled into the Jenkins code so I can have an idea of where to look? Thanks P.S.: I don't see Powershell as a savior of everything it will come with his set of execution policy and permission nightmare for those kind of thing. I personally would rather have a Python wrapper and do my own subprocess if needed there.

          Jesse Glick added a comment -

          All relevant files will be on your build agent in a …/workspace/jobname@tmp subdirectory. Here is a good place to start in the code.

          Jesse Glick added a comment - All relevant files will be on your build agent in a …/workspace/jobname@tmp subdirectory. Here  is a good place to start in the code.

          Shoo Yoo Yoon added a comment -

          the same at my PC.

          If the relative path is used in "Jenkins\Manage\Workspace Root Directory", then this issue comes.

          If the path is absolute path then it is OK.

          This is the content of jenkins-wrap.bat

          pipe_build is the pipeline job name.

          D:\jenkins\relFromYoon{color:#ff0000}ws\pipe_build{color:#ff0000}ws{color}pipe_build__tmp\durable-02c0f35d\jenkins-wrap.bat --> this file doesn't exist

          @echo off
          cmd /c ""ws\pipe_build\ws\pipe_buildtmp\durable-02c0f35d\jenkins-main.bat"" > "ws\pipe_build\ws\pipe_buildtmp\durable-02c0f35d\jenkins-log.txt" 2>&1
          echo %ERRORLEVEL% > "ws\pipe_build\ws\pipe_buildtmp\durable-02c0f35d\jenkins-result.txt"

           

          jenkins-wrap.bat should be placed on D:\jenkins\relFromYoon\ws\pipe_build\pipe_build__tmp\durable-02c0f35d\

          Shoo Yoo Yoon added a comment - the same at my PC. If the relative path is used in "Jenkins\Manage\Workspace Root Directory", then this issue comes. If the path is absolute path then it is OK. This is the content of jenkins-wrap.bat pipe_build is the pipeline job name. D:\jenkins\relFromYoon{color:#ff0000}ws \pipe_build{color:#ff0000}ws{color}pipe_build__tmp\durable-02c0f35d\jenkins-wrap.bat --> this file doesn't exist @echo off cmd /c ""ws\pipe_build\ws\pipe_build tmp\durable-02c0f35d\jenkins-main.bat"" > "ws\pipe_build\ws\pipe_build tmp\durable-02c0f35d\jenkins-log.txt" 2>&1 echo %ERRORLEVEL% > "ws\pipe_build\ws\pipe_build tmp\durable-02c0f35d\jenkins-result.txt"   jenkins-wrap.bat should be placed on D:\jenkins\relFromYoon\ws\pipe_build\pipe_build__tmp\durable-02c0f35d\

          xu shiming added a comment -

          I found if the job name is contains chinese ,this bug can ed reproduced,

          xu shiming added a comment - I found if the job name is contains chinese ,this bug can ed reproduced,

            Unassigned Unassigned
            rsahani999 Rajesh Sahani
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: