Since GitLab 17 CI jobs with a Windows Runner can no longer be canceled
Status update - 2024-11-14
The following MRs were merged to fix the cancelling issue on Windows Runner:
-
shell executor: Fix graceful termination of jobs on Windows (gitlab-runner!4808 - merged) • Nils Gladitz • 17.5: Implement graceful termination of Windows Runner usingpwshshell. Unfortunately, it doesn't gracefully terminatepowershelljobs but they end up being forcefully terminated after10 min -
kubernetes executor: All the known issues were fixed by the MRs below:- Fix graceful termination of jobs on Windows (gitlab-runner!4808 - merged) • Nils Gladitz • 17.5
- Cancel stage script upon job cancellation in at... (gitlab-runner!4813 - merged) • Romuald Atchadé - OOO until Jan 11th, 2026 • 17.5
- [k8s] Terminate PowerShell Script children proc... (gitlab-runner!5081 - merged) • Romuald Atchadé - OOO until Jan 11th, 2026 • 17.6
The issue will be closed. If anything else arises, please feel free to create a separate issue.
Overview
@allison.browne @ajwalker I've upgraded my self-hosted instance and runners to version 17 now but the issue seems to remain. I manually (via the UI) cancel one of my build jobs and it goes to the canceling state but the spawned build process does not get killed. I continue to see new build sub-processes spawning on the system with the runner and the job log keeps filling up. Minutes later after the job has successfully run to completion I see:
2024-05-16T18:32:23.135801Z 00O section_end:1715884343:step_script
2024-05-16T18:32:23.135801Z 00O+WARNING: script canceled externally (UI, API)
2024-05-16T18:32:23.136924Z 00O section_start:1715884343:after_script
2024-05-16T18:32:23.136924Z 00O+Running after_script
2024-05-16T18:32:23.897287Z 01O Running after script...
...
Status
- Fix for
pwshwas merged in 17.5 - Fix for
powershellscheduled for 17.6