explorer: forked workers have no timeout, no kill-on-drop, and waitpid(-1) reaps unrelated children

Open
#262 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
56/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust

Research direction

Start in crates/moonpool-explorer/src/worker.rs:160 and trace the wait_any call sites in controller.rs:313 and controller.rs:417, then inspect Explorer ownership and SharedMemory cleanup in shared_mem.rs:77. Done means Explorer cleanup terminates active workers, polling observes a per-worker wall-clock ceiling, and reaping is limited to pids spawned by the explorer.

Written by the indexing model from the issue text.

Description

bug

Found during the pre-release source audit of 8d9e779 (read-only, nothing compiled or run). Severity: medium. Status: confirmed.

Where

  • crates/moonpool-explorer/src/worker.rs:160 (wait_any: waitpid(-1, &status, 0), no WNOHANG, no deadline)
  • crates/moonpool-explorer/src/controller.rs:313 (final drain loop)
  • crates/moonpool-explorer/src/controller.rs:417 (reap_one_and_process)
  • Explorer has no Drop impl (only SharedMemory does, shared_mem.rs:77)

Failure scenario

A child stuck outside the simulation (a tight loop in user process code, a blocking syscall) is not covered by the in-simulation RunStallGuard; the controller blocks in waitpid until the CI job timeout kills everything with no diagnostic. A controller panic or SIGKILL orphans live children that keep running full simulations while holding the MAP_SHARED assertion and sancov regions. waitpid(-1, ..) also reaps any unrelated child of the host process when moonpool is embedded in a larger harness.

Proposed fix

Add a Drop for Explorer that SIGKILLs every pid in active, poll with WNOHANG against a per-worker wall-clock ceiling, and wait on the specific pids the explorer spawned.

Dominant language
Rust
Stars
49
Forks
3
Avg merge
1h 4m
Merged PRs (30d)
41

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PierreZ/moonpool

All issues in PierreZ/moonpool

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.