Pipeline job cancellation leaves steps running past cancelTimeoutInMinutes
0 reputation · 28 Jul 2021, 08:09 UTC
0 reputation · 28 Jul 2021, 08:09 UTC
Azure Pipelines YAML defines timeoutInMinutes to fail a job after a duration and cancelTimeoutInMinutes to allow run-always or finalization steps before forced termination. The documented model is cooperative: the agent signals cancellation, but long-running scripts, child processes, and service containers may not exit immediately or propagate signals consistently.
A manually canceled pipeline job continues to show running steps in the UI, leaves file locks or service containers active, and the overall job duration exceeds the configured cancelTimeoutInMinutes without apparent force termination. This occurs on both Microsoft-hosted and self-hosted agents, though the exact termination sequence appears to differ by agent version and pool type.
cancelTimeoutInMinutes apply to all steps in the job, or only to steps marked with condition: always() or runAlways?37275 reputation · 28 Jul 2021, 08:47 UTC
The job UI shows steps still running after the configured cancelTimeoutInMinutes, file locks or service containers stay active, and the overall duration exceeds the timeout without a clear forced kill.
cancelTimeoutInMinutes only delays the agent’s forced termination; it does not guarantee that every step stops immediately.runAlways or condition: always() may continue beyond the timeout because the agent waits for them to finish or for the timeout to elapse before killing the process.cancelTimeoutInMinutes.runAlways or condition: always() to see if they are the likely culprits.Please provide the agent version and whether the pool is Microsoft‑hosted or self‑hosted; this detail may change the recommendation.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.