Repository navigation
fix(minimald): log a box the daemon ended at debug, an unrequested exit as a warning - #3539
Conversation
…it as a warning Every box the daemon ends itself (a destroy, a forced stop, a daemon shutdown) reaps as `container received signal SIGKILL` with code 125, and that exit was logged as a warning with a `DIAG hakoniwa` prefix. It was the daemon's second most frequent warning and buried the kills nobody asked for. The process handle now records that its own kill succeeded, and the exit is logged at debug when the daemon killed the process and it died of a signal. An out-of-memory kill or any other outside SIGKILL reads the same, but no kill was sent, so it stays a warning; so does a non-zero exit the command made on its own. Both lines drop the `DIAG` prefix. Refs #3223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed: no findings; approval withheld, 1 thread unresolved at APPROVE withheld: 1 unresolved thread — norrietaylor crates/minimald/src/box_runtime/backend.rs. Resolving the last thread releases the approval on this head. Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required. Clobber: none seen. |
A process an outside SIGKILL ended, such as an out-of-memory kill, stays a zombie until it is reaped, and kill(2) on a zombie succeeds. The handle's kill then marked the exit as requested and it logged at debug, losing the warning. The kill now reaps without blocking first: an exit it finds is recorded as unrequested and no signal is sent. The check and the kill are not atomic, so a process that ends between them is still marked killed. The comment on the kill says so. Refs #3223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
The level choice in exit_log_level is correct. A box exit logs at debug only when the handle's own kill sent the signal and the process ended without an exit code of its own. A clean exit, an exit the command made itself, and a SIGKILL from outside (an out-of-memory kill, for example) still log at info or warning as before. The second commit checks for an exit without blocking before it sends the kill. So an outside kill whose process is not yet reaped keeps its warning. The status that check records is also what the destroy path's later wait() returns, so the exit is logged once. The window between the check and the kill that remains is documented. The tests cover each branch, including the zombie case. One non-blocking naming nit is inline.
Generated by Claude Code
| "hakoniwa container/process exited" | ||
| ); | ||
| } else if level == tracing::Level::DEBUG { | ||
| tracing::debug!( | ||
| code = reason.code, | ||
| exit_code = ?reason.exit_code, | ||
| reason = %reason.reason, | ||
| "session process ended after the daemon killed it" | ||
| ); | ||
| } else { | ||
| tracing::info!( | ||
| tracing::warn!( | ||
| code = reason.code, | ||
| exit_code = ?reason.exit_code, | ||
| reason = %reason.reason, | ||
| "hakoniwa container/process exited" | ||
| "session process exited non-zero" |
There was a problem hiding this comment.
Low (non-blocking): the two new log messages call the process a "session process", but HostProcess<SandboxBackend> hosts every box, task boxes included. AGENTS.md ("Naming: box, Box Type, sandbox") asks new text to say box, not session, when it means the box. So a task box that fails now logs session process exited non-zero. The three branches also no longer match: the INFO line keeps the hakoniwa container/process exited wording, while the PR drops that component name from the other two. Suggested fix: use one subject in all three branches, for example box process exited, box process ended after the daemon killed it and box process exited non-zero. Then update the example in docs/reference/linux-host-setup.md to match.
Generated by Claude Code
There was a problem hiding this comment.
Done in 8456303. All three branches now have one subject: box process exited, box process ended after the daemon killed it and box process exited non-zero. Levels and fields are unchanged, and the example in docs/reference/linux-host-setup.md matches. No test or other doc quoted the old texts.
…anches The exit log of a box's process named it three ways: the INFO line kept the `hakoniwa container/process exited` wording and the DEBUG and WARN lines said session process, though the host runs every box, task boxes included. All three now say box process (`box process exited`, `box process ended after the daemon killed it`, `box process exited non-zero`), with each line's level and fields unchanged. The example in the Linux host setup page follows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
When the daemon ends a box itself, that exit is now logged at debug. A box killed by something else is still a warning. Both lines lose their
DIAGprefix.Refs #3223
Why
A destroy, a forced stop and a daemon shutdown each end the box with SIGKILL. Every one was logged as a warning:
container received signal SIGKILL, code 125, with aDIAG hakoniwaprefix. In a week of telemetry it was the daemon's second most frequent warning. It hid the kills nobody asked for, which are the ones worth a warning.How
The process handle records that its own kill succeeded. The exit is logged at debug when both hold: the daemon killed the process, and the process died of a signal.
What stays a warning
Testing
a_box_the_daemon_killed_logs_its_exit_at_debugonly_a_kill_through_the_handle_marks_the_exit_as_requestedWorkspace lint, tests and the native end-to-end script pass on this commit.
🤖 Generated with Claude Code
Summary by CodeRabbit