Investigating Zombie Reaping Race Condition #13

Closed
opened 2026-02-22 09:04:15 +00:00 by rawan · 1 comment
Member

Location: crates/chvm-init/src/signal.rs:6-25

Issue:
The guest init spawns a separate reaper thread that waits for SIGCHLD. However, there's a race between:

  1. Main thread spawning a child process
  2. Reaper thread not yet installed signal handlers
  3. Child exiting before reaper reads it

This can result in zombie processes if the child exits before the sigwait() is active.

**Location:** `crates/chvm-init/src/signal.rs:6-25` **Issue:** The guest `init` spawns a separate reaper thread that waits for SIGCHLD. However, there's a race between: 1. Main thread spawning a child process 2. Reaper thread not yet installed signal handlers 3. Child exiting before reaper reads it This can result in zombie processes if the child exits before the `sigwait()` is active.
thabeta added this to the ACTIVE project 2026-03-12 10:53:26 +00:00
rawan self-assigned this 2026-03-16 10:10:48 +00:00
Author
Member

This race is no longer an issue. it was fixed in a my-celium PR

  • block_sigchld() calls sigprocmask(SIG_BLOCK, SIGCHLD) on the main thread, and as its documentation comments says, that it should be called before spawning any children so that SIGCHLD is inherited as blocked by all threads, ensuring the reaper thread can reliably catch it via sigtimedwait.
This race is no longer an issue. it was fixed in a my-celium PR - `block_sigchld()` calls sigprocmask(SIG_BLOCK, SIGCHLD) on the main thread, and as its documentation comments says, that it should be called before spawning any children so that SIGCHLD is inherited as blocked by all threads, ensuring the reaper thread can reliably catch it via sigtimedwait.
rawan closed this issue 2026-03-17 23:14:28 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
geomind_code/my_hypervisor#13
No description provided.