refactor(crash): extract ProcessMonitor and improve crash diagnostics#240
Merged
DorianZheng merged 1 commit intomainfrom Feb 12, 2026
Merged
refactor(crash): extract ProcessMonitor and improve crash diagnostics#240DorianZheng merged 1 commit intomainfrom
DorianZheng merged 1 commit intomainfrom
Conversation
3f6e736 to
a1f7d01
Compare
- Add ProcessMonitor abstraction for waitpid-based process liveness detection - Capture stderr to file BEFORE subprocess spawn (catches pre-main dyld errors) - Pass BoxFilesystemLayout through spawn chain (DRY - no redundant recreation) - Remove stderr from ExitInfo::Signal (CrashReport reads directly from file) - Simplify CrashCapture::install() to only take exit_file parameter The ProcessMonitor encapsulates the Unix parent/child constraint for waitpid, handling both owned (spawned) and attached (reconnected) process modes with explicit ProcessExit::Code vs ProcessExit::Unknown return types.
a1f7d01 to
31f4d04
Compare
4 tasks
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.
Summary
ProcessMonitorabstraction for waitpid-based process liveness detectionBoxFilesystemLayoutthrough spawn chain (DRY - no redundant recreation)stderrfromExitInfo::Signal(CrashReport reads directly from file)CrashCapture::install()to only takeexit_fileparameterDetails
ProcessMonitor Abstraction
Extracts duplicated waitpid polling logic into a minimal struct:
This encapsulates the Unix parent/child constraint for
waitpid():waitpid()to get exit codeECHILD, fall back tokill(pid, 0)Stderr Capture Before Spawn
Previously, stderr was redirected inside the shim's
main(), losing pre-main errors (dyld library loading failures). Now the parent creates the stderr file BEFORE spawn:Layout Pass-Through
Eliminates redundant
FilesystemLayoutrecreation inspawn_subprocess()by passingBoxFilesystemLayoutthrough the call chain.Test plan
cargo build --package boxlitecargo test --package boxlite process(12 tests pass)cargo test --package boxlite guest_connect(8 tests pass)cargo test --package boxlite crash_report(7 tests pass)