docs: the root-exit sweep does not reach children of a still-live parent

The sweep's trace comment claimed a forgotten actor "costs only a slot,
never a hung run". Not so for a non-trapping child of a parent still live
at sweep time: it is skipped, stopping the parent does not reach it, and
if it loops until told otherwise the run never ends (the try_spawn race
test hit this). Comment corrected; the ROADMAP item on post-sweep spawns
now covers existing children too. Behaviour unchanged.
This commit is contained in:
smarm-agent
2026-10-18 09:20:15 +02:00
parent 164a83eb73
commit e25b27cfe0
2 changed files with 11 additions and 4 deletions
+7 -1
View File
@@ -304,7 +304,13 @@ outright — `join` what you need finished. No forcing sweep follows.
kill); OTP would deliver a trappable `killed`. Chosen for boundedness.
- A root-exit shutdown reaches only actors live *at that instant*; a
non-trapping forest root that spawns before it unwinds leaves that spawn
to itself (Erlang: an unlinked spawn is nobody's child).
to itself (Erlang: an unlinked spawn is nobody's child). The same holds
for children it already had: they sit under a live parent at sweep time,
so they are skipped, and stopping the parent does not reach them. A child
that loops until told otherwise then keeps the run alive (seen as a hang in
`try_spawn`'s race test whenever its root panicked mid-race). Closing it
means sweeping a forest root's live children when it finalizes after root
exit; that changes teardown semantics, so it is not done yet.
- **Supervisor start *order* is not start *readiness*.** `start_child`
spawns and moves straight on, so an earlier child is merely *scheduled*,
not initialised, when a later sibling starts. A later child that resolves
+4 -3
View File
@@ -2116,9 +2116,10 @@ fn shutdown_forest_roots(inner: &Arc<RuntimeInner>, root: Pid) {
.is_some_and(|ps| ps.is_live_for(parent));
if !parent_live {
// `_probe` so the trace can say what each leftover was: under
// `smarm-trace` every swept actor is a `root_sweep` line — the
// visibility that makes "a forgotten actor costs only a slot, never
// a hung run" a checkable claim rather than a hope.
// `smarm-trace` every swept actor is a `root_sweep` line. Only
// forest roots are swept: a non-trapping child of a parent still
// live here is never addressed, and if it never exits on its own
// it keeps the run alive after that parent is stopped.
let found = crate::scheduler::request_shutdown_inner_probe(inner, pid, root);
#[cfg_attr(not(feature = "smarm-trace"), allow(unused_variables))]
if let Some(trapping) = found {