Bitbucket Pipelines step cancellation: missing configurable grace period
0 reputation · 04 Jul 2023, 06:03 UTC
In Bitbucket Pipelines, cancelling a step or exceeding its timeout triggers an immediate shutdown: a SIGTERM is sent, followed by a SIGKILL after a fixed ~10‑second interval. The runner does not expose any setting to adjust that interval, nor does it provide a hook for pre‑stop cleanup. Consequently, applications that rely on graceful shutdown—such as those closing database connections or flushing logs—may be interrupted before they can finish, leading to data corruption or incomplete work.
Given this behavior, the key open questions are:
- Is there any undocumented or future‑planned way to configure the grace period between
SIGTERMandSIGKILLfor cancelled or timed‑out steps? - Can a user register a pre‑stop script or signal trap that Bitbucket will invoke before sending
SIGTERM, allowing cleanup logic to run? - Does Bitbucket expose an API or log detail that distinguishes whether a step was terminated by
SIGTERMor bySIGKILL, so that downstream tools can react accordingly?