fix: keep script shutdown independent of stdout writes - #301
Merged
Conversation
swananan
marked this pull request as ready for review
September 6, 2026 04:59
swananan
force-pushed
the
fix/report-partial-script-failures
branch
from
September 6, 2026 11:30
7b5d007 to
f418dcf
Compare
swananan
force-pushed
the
fix/cancellable-script-output
branch
from
September 6, 2026 12:40
d366401 to
9314b7d
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.
When a stdout consumer stops reading, script output can block the CLI event loop and prevent signal handling. A closed consumer or another write failure could also leave tracing running after output had failed.
Send rendered output through a bounded queue to a dedicated thread owning a duplicate stdout descriptor. Signals remain observable while waiting for queue capacity. Writer completion stops tracing: a broken pipe exits normally, while other I/O failures return an error. The writer owns no session or probe resources and uses neither Rust's global stdout lock nor Tokio's blocking pool.
On graceful shutdown, release the session and allow accepted output up to 100 ms to drain. A deadline expiry or an interrupted producer batch reports abandoned output. That best-effort stderr notice uses its own bounded writer and 100 ms deadline, so redirecting stderr into the blocked stdout pipe cannot introduce a shutdown wait. An outstanding OS write is not forcibly cancelled and its dedicated thread is not joined.
Rebased onto main at
9b0c982, with the review fixes amended into one commit,9314b7d; four files changed.Validation:
/dev/fulland a consumer resuming during shutdown. The final CLI returns ENOSPC as an error, drains queued data, and reports interrupted output.All nine applicable GitHub checks passed on
9314b7d, including standard e2e, three full container topologies, and host-PID smoke. Local container-topology runs were omitted because this change does not alter container behavior.