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

Aborting a Job running on Windows terminates the process immediately with no chance to run build clean up code, thus leaves build related lock files hanging at slave.


    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: core
    • Labels:
    • Similar Issues:


      I have Jenkins setup with many build and test jobs running on Windows and Linux.

      I am noticing issue with aborting/cancelling jobs running on Windows hosts. It terminates the job, but leaves lock files at various places depending on the build phase the job got aborted, thus impacts further jobs landing in the workspace.

      On linux it works fine as I have a build wrapper that detects SIGTERM signal received on abort and terminates the build gracefully by clearing all the locks etc.

      But unable to do such thing on Windows.

      I came to know from https://wiki.jenkins.io/display/JENKINS/Aborting+a+build that on Linux, job is aborted through java.lang.UnixProcess.destroyProcess, which sendsSIGTERM on Sun's JREs, while on Windows, this is done through TerminateProcess API.

      If a process is terminated by TerminateProcess, all threads of the process are terminated immediately with no chance to run additional code. This means that the thread does not execute code in termination handler blocks. In addition, no attached DLLs are notified that the process is detaching. (source: https://msdn.microsoft.com/en-us/library/windows/desktop/ms686722(v=vs.85).aspx)

      From above, it looks like on Windows Jenkins is using a job termination process that is inefficient and can't be handled gracefully by executing build process on Windows host.

      Can we have a similar procedure for Windows Job termination as it's handled in case of Linux job termination?



          Issue Links



              • Assignee:
                shaupa01 Sharad Upadhyaya
              • Votes:
                2 Vote for this issue
                4 Start watching this issue


                • Created: