Repository navigation
feat(run-task): send SIGTERM to the task's processes shortly before maxRunTime - #1084
Open
benoitgoupilleau wants to merge 1 commit into
Open
benoitgoupilleau wants to merge 1 commit into
benoitgoupilleau wants to merge 1 commit into
Conversation
…axRunTime When a task exceeds its maxRunTime, the worker kills its processes straight away, so test harnesses can't log that they were aborted, and their structured logs just stop. run-task now aborts the task itself, 5% of maxRunTime early and at most 60 seconds early: it sends SIGTERM to its process group, keeps forwarding the output of its command until it exits, and then fails the task. The task transform passes maxRunTime to run-task in the TASKCLUSTER_MAX_RUN_TIME environment variable, for both docker-worker and generic-worker. The worker's own kill is unchanged, and still happens if the task's processes ignore SIGTERM. Nothing changes on Windows. This is the upstream counterpart of the gecko change in https://bugzilla.mozilla.org/show_bug.cgi?id=2082559, needed by the gecko tasks that run the upstream run-task as run-task-git.
benoitgoupilleau
force-pushed
the
run-task-max-run-time-abort
branch
from
October 30, 2026 14:35
544a30a to
77add46
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a task exceeds its
maxRunTime, the worker kills its processes straight away, so test harnesses can't log that they were aborted and their structured logs just stop.This makes run-task abort the task itself shortly before the deadline:
maxRunTimeto the task in theTASKCLUSTER_MAX_RUN_TIMEenvironment variable, for both docker-worker and generic-worker payloads.maxRunTimeminus 5%, capped at 60 seconds early. It sends SIGTERM to its process group (run-task is PID 1 under docker-worker/d2g and the group leader under generic-worker), or to its direct child if it is not the group leader.128 + signalif the child died from a signal) and prints a line saying the task was aborted for exceeding itsmaxRunTime.The worker's own kill at
maxRunTimeis unchanged and remains the backstop if the task's processes ignore SIGTERM. Nothing changes on Windows, and tasks withoutTASKCLUSTER_MAX_RUN_TIMEin their environment behave as before.This is the upstream counterpart of the gecko change in https://bugzilla.mozilla.org/show_bug.cgi?id=2082559 (D338003), needed by the gecko tasks that run the upstream run-task as
run-task-git.Tests cover the margin calculation, invalid values, both signalling paths, a real child that receives SIGTERM while its output keeps flowing, the exit code mapping, and the transform for both worker implementations.