You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dvm: a worker that closes stdout can no longer be killed #1102
Found by the static review of the 026-nwc-req-before-event branch, run after its round 1: the finding is in a file that branch does not touch, and it is pre-existing on rewrite/main at 4adaa42.
The mechanism
crates/nostream-services/src/workers/dvm_orchestrator.rs:581-612 — drive_worker reads the child's stdout and watches the kill channel in one select!:
The killed arm is polled only inside the loop. Once stdout closes — a worker that finishes its output and then hangs, or one whose output is redirected — the function leaves the loop and blocks in process.wait(), where a later kill request has nothing polling its receiver. The sender in kill_worker completes, the child is never killed, and it survives until it exits on its own. Child is held right there, so the kill is still deliverable; nothing delivers it.
What a fix needs
Keep the killed arm active while waiting — a second select! over process.wait() and killed — or kill and reap the child when its output closes if that is the intended policy for a worker that ends its stream. Either way there needs to be a test with a child that closes stdout and then sleeps, asserting the kill reaches it; the current tests drive a child that exits, which is why this is invisible.
Activity