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

Pipeline hangs if renaming of jenkins-result.txt.tmp fails - retry?

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major

      We run a Bash script from a declarative pipeline's sh step on Windows. Intermittently, the pipeline job hangs before it has a chance to write Finished: SUCCESS to the Jenkins console output. Whenever this happens, we find a hung bash.exe process on the job's host node. Its command line:

      "C:\Program Files\Git\bin\..\usr\bin\bash.exe" -c "({ while [ -d 'C:\ci@tmp\durable-ea1adebb' -a \! -f 'C:\ci@tmp\durable-ea1adebb\jenkins-result.txt' ]; do touch 'C:\ci@tmp\durable-ea1adebb\jenkins-log.txt'; sleep 3; done } & jsc=durable-d228ea4e86adf412d44f7823efac746d; JENKINS_SERVER_COOKIE=$jsc 'sh' -xe  'C:/ci@tmp/durable-ea1adebb/script.sh' > 'C:\ci@tmp\durable-ea1adebb\jenkins-log.txt' 2>&1; echo $? > 'C:\ci@tmp\durable-ea1adebb\jenkins-result.txt.tmp'; mv 'C:\ci@tmp\durable-ea1adebb\jenkins-result.txt.tmp' 'C:\ci@tmp\durable-ea1adebb\jenkins-result.txt'; wait) >&- 2>&- &"
      

      After some investigation, it appears this happens because the mv command sometimes fails - possibly due to interference by anti-virus software. Please can Pipeline be made more resilient to such failures by retrying the mv command until it succeeds?

      Similar past issue for bat steps: https://issues.jenkins.io/browse/JENKINS-50025

            Unassigned Unassigned
            nan Arnie Alpenbeach
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: