fix(v2): exit the validator when a service fails in threaded mode - #1769
Open
Rhovian wants to merge 3 commits into
Open
fix(v2): exit the validator when a service fails in threaded mode#1769Rhovian wants to merge 3 commits into
Rhovian wants to merge 3 commits into
Conversation
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.
Problem
After the first service fails,
mainreturns fromChildren.wait, dumps diagnostics, and falls off the end — the other service threads keep running. With-Denable-tracy(the #1722 setup), libcexit()then blocks in tracy's shutdown, draining an event queue those threads keep refilling: the error trace prints, then the validator hangs.Solution
Children.waitnow returns anExitStatus; failure includes a sandboxed child exiting outside the service protocol (code ≠ 255, previously classified clean).Children.shutdown(code): cancel all services, brief grace period, then rawexit_group— bypassing libc/tracy teardown (std.posix.exitwon't: it routes through libcexit()when libc is linked).abort()is mode-aware: thread-only exit in threaded mode,exit_groupin sandboxed mode sowaitpidfires when a multi-threaded service panics.Deliberately out of scope: #1661 (services allowed to exit without stopping the validator — the shutdown decision is kept in one place in
mainso it can grow an allowlist) and-Denable-tracyCI coverage of the new test.Verification
mainat this branch's merge-base (330cc62), ReleaseSafe,-Denable-tracy, threaded, active tracy capture client: wedged >60s after the error trace. Same scenario on this branch exits nonzero in ~1s.zig build bb-test-threaded-exit: failing service + tracy-emitting long-runner, asserts prompt exit 1; passes with and without-Denable-tracy.zig build testgreen on Linux.cc @dnut
Closes #1721