Repository navigation
fix(tier3): give the Windows process-tree kill longer than a plain reap - #687
Merged
Merged
Conversation
On Windows a Harbor run that times out or exceeds its output limit is stopped with taskkill /T /F. The product waited 5 seconds for taskkill, the budget it uses to reap a process that was already signalled. When taskkill needed longer, it was killed and the run failed with 'Harbor process-tree cleanup could not be confirmed' in place of its own error. Tier 2 (windows-latest) failed this way on 10 and 14 Nov. The tree kill now has its own 30 second bound. The other waits keep the 5 second budget, and a taskkill that never returns is still killed and still fails closed. Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
rng1995
reviewed
Nov 16, 2026
rng1995
left a comment
Collaborator
There was a problem hiding this comment.
Independent review of 88343ba8: no actionable issues found in the changed code. Focused validation and its scope are recorded inline.
rng1995
reviewed
Nov 16, 2026
rng1995
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed at 88343ba8. One P3 inline. The bound change and the fake-process test are correct; the focused Windows-cleanup tests pass locally (6 passed).
The Windows branch of the process-tree kill ignored end_grace, so after a
second Ctrl+C ("skips wait") the forced-cancel path could still block for the
full 30 s taskkill budget.
Wait for taskkill in short slices instead of one blocking call. Once end_grace
is set and taskkill is still running, stop waiting, kill it and fail closed
as for a timeout, since the tree was not confirmed stopped. The normal wait
budget and the 5 s reap budgets are unchanged.
Tests drive the wait with a simulated clock: forced cancellation returns
promptly and fails closed, an unforced slow taskkill is still waited out, and
a taskkill that finishes despite the force is kept.
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
chrisknvidia
marked this pull request as ready for review
November 16, 2026 21:05
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
5 of 9 tasks
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.
Summary
On Windows, a Harbor run that times out or exceeds its output limit is stopped with
taskkill /PID <pid> /T /F. The product waited 5 seconds fortaskkillto finish, the same budget it uses to reap a process that has already been signalled. Whentaskkillneeded longer, the product killedtaskkillitself and raised:That has two effects for a Windows user. The tree kill is cut short, so descendants may be left running. And the run's own error ("timed out after ...", "output exceeded the ... limit", with the last output) is replaced by the cleanup error.
It also shows up as a flaky test.
Tier 2 (windows-latest)failed this way on 10 Nov intest_bounded_harbor_process_drops_partial_secret_at_output_limit:The same job failed again on 14 Nov in
test_bounded_harbor_process_failure_reaps_windows_descendants[timeout]:That log shows the cleanup error but not what caused it, so the 5 second timeout is the likely cause there, not a confirmed one.
Cause
In the 10 Nov job the failing test was the first in the session to reach
taskkill. The next sixtaskkillcalls in the same run all finished, and averaged well under 1.5 seconds each. So this looks like a slow first call on a fresh machine, not a hang.taskkill /Thas to look the task tree up before it kills anything. I have no measurement of how long the slow call needed, only that it was more than 5 seconds.Fix
The tree kill gets its own bound,
_HARBOR_WINDOWS_TREE_KILL_SECONDS = 30.0. Everything else keeps the 5 second reap budget: the wait aftertaskkillitself is killed, the wait for the root process, and the POSIX path.The 30-second bound covers waiting for
taskkill, rather than the entire cleanup. The code still attempts to kill and reap a hungtaskkilland fails closed if cleanup cannot be confirmed.Please look at
taskkill, 5 seconds to reap a killedtaskkill, and 5 seconds to reap the Harbor root: 40 seconds of configured waits, versus 15 previously. The surrounding runner can retry tree cleanup and then join its output and stdin threads for 5 seconds each. If both attempts and both joins exhaust those budgets, their sum is 90 seconds versus 40 previously. Process creation and OS calls add overhead, so these are wait-budget totals, not strict wall-clock guarantees.Verification
I am familiar with the Contributing Guidelines
Added or updated focused tests
Updated documentation for user-visible changes (none needed)
Ran
make lint(ruff checkon the changed files)Ran
make testRan
make buildDid not add credentials, private datasets, or proprietary benchmark content
New test
test_windows_tree_cleanup_gives_taskkill_longer_than_a_plain_reapuses a fake process, so it runs on every OS. One case hastaskkilltake twice the reap budget and checks cleanup succeeds without killing it. The other hastaskkillnever return and checks it is killed and cleanup fails closed.With the tree kill put back on the 5 second budget, both cases fail.
tests/test_harbor_runner_status.pypasses: 160 passed, 2 skipped (macOS, Python 3.12). The 2 skipped are the real-Windows tests.Hosted validation at
88343ba8: Windows job 133554358314 succeeded on Windows Server 2025 / CPython 3.12.10. Its command selectedtests/test_harbor_runner_status.pyand its aggregate was 5,076 passed, 172 skipped. The quiet log does not report individual taskkill timings, and it does not prove a slow first call exceeded five seconds or that the rare historical failure is eliminated. Three additional scaled real-subprocess controls cover successful delayed cleanup, the shorter-budget failure, and hung-tool termination.Not verified:
Release Impact
CHANGELOG.mdOne entry under Fixed.