Skip to content

fix(stdlib): report child crashes before init_ack - #39

Merged
mremond merged 1 commit into
mainfrom
fm/task-0091ba46
Nov 14, 2026
Merged

mremond merged 1 commit into
mainfrom
fm/task-0091ba46

Conversation

@mremond

@mremond mremond commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Why

A child crashing before init_ack left proc_lib callers that trap exits waiting forever.

What changed

  • Return startup errors instead of hanging when the child dies before acknowledgement.
  • Preserve BEAM's error and uncaught-throw reasons, including stacktraces.
  • Keep successful startup links and consume only startup exit and monitor messages.

Before and after

Before: The native regression waited five seconds at its first start before its guard reported a hang.

After: Both startup arities now return BEAM's error reasons to trapping callers and terminate non-trapping linked callers with those reasons.

This changes library-call results rather than a screen; native and BEAM process transcripts demonstrate the behavior.

Checked

Live validation: Demonstrated for this version. 3 of 3 scenarios driven live in the product.

Scenario Result Evidence
Trapping callers receive startup errors with BEAM reasons through both arities. ✅ Passed live Ten completed runs each on native/default, native/single scheduler and BEAM; Nera's implementation also passed ten BEAM runs.
Non-trapping linked callers exit with the child's reason instead of returning. ✅ Passed live The fixture checked actual caller monitor messages for error, exit and uncaught throw in both arities.
Acknowledgements, metadata, successful links and mailbox cleanup remain correct. ✅ Passed live Both init_ack forms, immediate post-ack exit and normal pre-ack termination passed every completed fixture run.
  • Original native failure: The regression reproduced the pre-acknowledgement hang on unchanged code.
  • Complete local gate: Ordered release builds, strict lint, 2,168 Rust passes, 490 native Erlang passes, allocator and stacktrace probes passed; one ignored Rust test and two external-module skips.
  • Inherited test storage: The linker-boundary journey verified private executable directories, fallback, fail-closed behavior and cleanup.
  • Independent review: Independent reviews found no material issues in the startup implementation and regression.
How it was checked

cargo build --release --locked -p nera-runtime; cargo build --release --locked -p nera; cargo build --release --locked

cargo clippy --workspace --all-targets --locked -- -D warnings

cargo test --workspace --locked --no-fail-fast

python3 scripts/test-allocator-config.py

./target/release/nera test -j 1 --timeout 30

python3 scripts/test-stacktrace-order.py

python3 scripts/test-test-storage.py

Local execution used macOS arm64; repeated fixture runs used no retries.

Risk

Risk: low in every dimension.

Full risk assessment
Dimension Level Why
Blast radius low Changes only proc_lib's synchronous startup path and its documentation.
Behavior low Corrects a hang and restores the requested BEAM error reasons.
Undo low Reverting requires no saved-data or configuration migration.
Evidence low Real native and BEAM processes exercise both caller exit modes.
Sensitivity low No credentials, user data, signing or release behavior changes.
Novelty low Reuses the existing atomic spawn, monitor and signal-cleanup pattern.
Dependencies low No dependency changes.
Not done

Finite startup timeouts and spawn options remain unsupported.

Ranch and Cowboy startup were not revalidated.

Pipeline

Updates from git push no-mistakes

Infinitary checked this version: an independent review that also judged the documents, and live validation the review accepted.

@github-actions github-actions Bot added this to the 0.1.1 milestone Nov 14, 2026
@mremond
mremond merged commit 74301ce into main Nov 14, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant