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
The ? propagates out of the whole function, so the if remove block is never reached. Because this is a loop, a failure on one container also abandons every remaining container in the list.
Why it surfaced now
This code is unchanged since early on — but it was effectively unreachable. Before #8, check_error in crates/apple-container/src/xpc/message.rs read the daemon's error payload with get_string, while the daemon sends it as XPC data. Every daemon error deserialized to None and returned Ok(()), so stop_container could not fail. #8 fixed that, which makes this latent ? reachable for the first time.
Scope
Apple runtime only, as far as observed. Docker teardown was verified clean in the same session (dev up → dev shell → dev down --remove, container removed, none left behind).
Intermittent — 1 occurrence in 4 attempts, with 3 consecutive clean up/down cycles immediately afterwards.
Not destructive and self-recoverable — re-running dev down --remove removes the stranded container.
The stop options fix(apple): Apple Container runtime support #8 sends ({"timeoutInSeconds": 5, "signal": 15}) match Apple's own CLI defaults (container stop defaults to SIGTERM and --time 5), so the values are not the problem. The daemon's internal XPC call to the sandbox is what times out.
Suggested fix
Two independent improvements, either of which prevents the stranded container:
Don't let a stop failure skip the removal. Re-check container state after a failed stop; if it is no longer running, proceed to remove. Trusting observed state over the call's return value is the same approach fix(shell): exit immediately when container shell exits #1 used for dev shell — it polls inspect_exec until running == Some(false) rather than trusting the stream to close.
Don't let one container abandon the rest of the loop. Collect per-container errors and continue, reporting failures at the end.
(2) is worth doing regardless of this specific timeout, since it is a plain robustness gap in teardown.
Symptom
dev down --removecan leave a stopped but not removed container behind. Observed once on the Apple runtime:Checking the daemon immediately afterwards showed the container had in fact stopped:
So the stop succeeded while reporting failure, and the removal never ran. Re-running
dev down --removecleans it up.Cause
src/commands/down.rs:36-48:The
?propagates out of the whole function, so theif removeblock is never reached. Because this is a loop, a failure on one container also abandons every remaining container in the list.Why it surfaced now
This code is unchanged since early on — but it was effectively unreachable. Before #8,
check_errorincrates/apple-container/src/xpc/message.rsread the daemon's error payload withget_string, while the daemon sends it as XPC data. Every daemon error deserialized toNoneand returnedOk(()), sostop_containercould not fail. #8 fixed that, which makes this latent?reachable for the first time.Scope
dev up→dev shell→dev down --remove, container removed, none left behind).dev down --removeremoves the stranded container.{"timeoutInSeconds": 5, "signal": 15}) match Apple's own CLI defaults (container stopdefaults toSIGTERMand--time 5), so the values are not the problem. The daemon's internal XPC call to the sandbox is what times out.Suggested fix
Two independent improvements, either of which prevents the stranded container:
dev shell— it pollsinspect_execuntilrunning == Some(false)rather than trusting the stream to close.(2) is worth doing regardless of this specific timeout, since it is a plain robustness gap in teardown.