roadmap BUILT

254. A caller stranded by a server that died is stranded forever, and nothing records that as intended

Built. This is the half of milestone 133 (ending a permanently blocked thread, and deciding who may) that is a defect rather than a fork, which is why calef took it first.

In brief. abi::Error::Gone does not reach a reply-parked caller. The abort machinery walks an endpoint's wait queues, but a caller whose request was taken was popped off at the rendezvous; it is woken by sched::ipc_reply and by nothing else. So a caller stranded by a server that merely died stays blocked for the life of the machine.

Nothing in this tree records that as intended, which is what makes it a defect rather than a design. QNX Neutrino has not permitted it since the 1990s:

If the server thread fails, exits, or disappears, the client thread becomes READY, with MsgSend() indicating an error

Zircon reaches the same outcome by a different route (closing the channel, rather than touching the thread). Both are in notes/blocked-thread-teardown.md's survey, and nobody in that survey blocks forever with no way out.

Why this is separable from milestone 133, and why it goes first

Milestone 133 is a genuine fork: which held capability expresses the right to end a thread, with four proposals conceding different things, and it touches the system call surface under one of them. This is proposal C's first piece and it is the only part of that milestone that asks for no authority anybody does not already hold. It rides on destroying a region or destroying an endpoint, both of which the kernel already witnesses, and changes only their reach.

The note says so in as many words:

It is the only proposal here that is plainly complementary to the others rather than an alternative to them

So it can be taken with A, with B, or alone, and taking it first costs milestone 133 nothing.

It does not solve 133's capacity problem and must not be quoted as if it did. A hung component's own region stays unreclaimable. What this halves is the compounding: today one hang strands every caller in flight and each stranded caller is itself an unreclaimable region, so a service with many callers costs one region per caller. After this, one hang costs one region.

The hazard this cannot ship without solving

Waking a reply-parked caller is exactly the path that opens the stale reply capability, and milestone 133's block states it as a hazard for every proposal:

cap::reply_cap mints Object::Reply(tid), whose payload is a generational thread name with no call identity. ipc_reply's guard checks the WaitRole and discards the endpoint, and that is sound only because nothing today can leave a reply park and enter a second CALL while an unconsumed Reply names it. This milestone creates that path. A hung server's stale reply capability would then forge an answer to a later, unrelated call, and L4Re documents the identical hazard as a consequence of its own finite receive timeouts.

Two known fixes, both seL4's, and this milestone must take one and say which: delete the outstanding reply capability at abort (a cspace sweep, the pattern sched::delete_frame_caps already establishes), or do not wake the victim at all. The second is not available here, because waking the victim is the entire point.

The sweep is not optional and is the larger half of the work. A block that shipped the wake without it would trade a permanent block for a forgeable reply, which is a worse defect in a capability system than the one it fixes.

What the mechanism already provides

Milestone 133's research established that the kernel can do this and only the authority was open. For this half the authority question does not arise, so what remains is mechanical:

What was built

One helper that frees a caller, strand_reply_caller, two finders that decide which callers, and four trigger sites. All of it is in kernel/src/sched.rs; no system call number, no method, no right, and no ABI change, which is exactly what the block's gate line claimed before it was struck as stale on the way to BUILT.

The helper does the two things in the order that makes them safe. First the sweep. Every Object::Reply(caller) in every capability table in the machine is deleted, and so is one riding in a thread's outgoing_cap, which is where a caller that met no server parks its own reply capability awaiting a RECV_CAP hand-off. Then the abort and the wake, which is set_ipc_aborted plus wake, the pair reap_region_objects already ran against every waiter it drained. The system call layer needed nothing: abi::rendezvous::CALL already reads take_ipc_aborted and returns abi::Error::Gone, so the caller returns through a path that has existed since milestone 12.

It touches only a thread that is genuinely reply-parked, which is ipc_reply's own guard reused, so it cannot clobber an ordinary receiver's park.

The four triggers, and why there are four rather than the two the block predicted. The block named the destruction of the server's region or of the rendezvous. Reading the code found the rendezvous is one path and the server ceasing to be able to answer is three, because a thread's capability table can stop existing by three different routes:

Trigger Site The case it covers
The rendezvous is torn down reap_region_objects, rendezvous phase Zircon's: the channel closes and the call in flight fails, without touching the server
The server exits or faults depart QNX's headline case, and the one the title names: the server thread fails, exits, or disappears
The server is forcibly killed schedule, DECISIONS ยง16's armed-kill conversion a killed thread never reaches depart, so nothing else would have swept it
The server is reaped with its region reap_region_objects, removal phase an Embryo, or a corpse already converted by one of the two above

The rendezvous trigger cannot be reached by scanning a wait queue, and that is the defect stated mechanically. A CALL caller whose request was taken is linked on no queue at all, so drain_waiters walks past it and only wait_on's (ep, WaitRole::Reply) still records that it is waiting. The scan is over MAX_THREADS, and it rescans rather than listing, because a [u64; MAX_THREADS] of victims is a kilobyte of scratch on the deepest frame in the kernel (reap_region_objects's own comment, and notes/stack-high-water.md). The abort flag is what terminates the rescan, and it has to be the flag rather than wait_on: a wake deferred behind on_cpu leaves the park in place until that core's finish_switch, so a predicate reading wait_on alone would spin.

The proof that this milestone worked

Two tests in kernel/src/sched.rs, and both were run against the kernel with the four trigger calls commented out, where each fails at the assertion it exists for: "the stranded caller never woke" and "the caller was still parked after its server exited". Both pass on all four boot configurations the suite runs (aarch64, riscv64, x86_64, and x86_64 under OVMF).

The stale-reply half is asserted in both, which is the half that matters: without it this milestone would have traded a permanent block for a forgeable reply, and a test asserting only the first would pass while that were true. Two assertions carry it. outstanding_reply_capabilities counts every live Reply naming the freed caller anywhere in the machine, including outgoing_cap, and must be zero. And the surviving server in the first test re-reads its own slot through sched::current_cap, which is the same lookup abi::reply::REPLY performs before it ever reaches ipc_reply. A capability that is gone there is a reply that cannot be sent at all. Each test also asserts the server held a live capability beforehand, so neither can pass vacuously.

Note what the sweep is doing and what it is not. ipc_reply's guard still checks the WaitRole and discards the rendezvous, so the kernel-internal function would still deliver to a re-parked caller if anything could call it without a capability. Nothing can: the capability is the gate, and the sweep takes the capability. That is seL4's non-MCS answer (cteDeleteOne(callerCap) off cancelIPC) rather than a call identity in the payload, and a call identity remains the stronger fix somebody could still take.

BUGS

Follow-on

Index row

Gone reaches endpoint wait queues and not reply parks, so a dead server blocks its callers for the life of the machine