Repository navigation
Conversation
The subprocess watchdog was alarm(5) with the default SIGALRM action, so a child that needed longer than five seconds died from the signal and the parent returned -1, indistinguishable from a crash or a failed assertion. The stress loop is wall-clock heavy rather than slow: on a machine saturated with 16 busy loops it was measured taking up to 30.8s while still completing, and 19 of 40 runs failed at the five second mark. That makes the test a disguised performance assertion, and it fails in loaded CI builders. Give the watchdog a generous budget and install a handler that exits with a dedicated code, so an expiry is reported as an expiry instead of -1, and add the outcome to the failure message. The stress magnitude is unchanged: the point of the test is the volume of concurrent wake and stop calls. Measured after the change: 0 of 40 runs fail under the same load, and the full utils suite passes with 772 assertions in 44 cases.
twstagg
force-pushed
the
fix/sleeper-thread-watchdog
branch
from
November 2, 2026 07:26
fd39262 to
6c4b8f0
Compare
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.
Symptom
Once configure succeeds (see #5431), the
utilssuite is what fails in a loaded build:It looks like a
SleeperThreaddefect. It is not: it is the test's own watchdog, and it only fires when the machine is busy, so it reads as a flake.Cause
run_in_subprocessstarts the task underalarm(5)and leavesSIGALRMat its default disposition, which terminates the child. The parent then sees!WIFEXITED(status)and returns-1— the same value it returns for a fork failure or a crash. So a child that simply needed more than five seconds is reported identically to a genuine logic failure, and the message gives no hint that a timeout happened at all.The stress loop is wall-clock hungry rather than slow: it runs 200 iterations of thread creation, 100
wake_up()calls,stop()andjoin(), so under scheduling pressure every iteration pays for context switches. Measured on a 16-core machine saturated with 16 busy loops, the loop still completed, taking up to 30.8 s:mastermaster+ #5431Every failure sits at ~5.0 s, i.e. exactly at the alarm. The five-second budget is therefore an undeclared performance assertion attached to a correctness test, and it fails on shared CI runners and on any machine doing parallel builds — the Nix build in particular.
Change
124) on expiry, so an expiry is distinguishable from a crash instead of arriving as "killed by a signal".watchdog expired: the stress loop did not finish…rather than-1 == 0.The stress magnitude is deliberately unchanged — the volume of concurrent wake and stop calls is the point of the test.
Verification
utilssuite: 772 assertions in 44 test cases, all passing.[sleeper_thread]under 16-core saturation: 0 failures (was 19–25 of 40).Ok: 3, Fail: 0.Depends on #5431 only in the sense that it is what you hit next; the two changes are independent.