On this page

0175: Mailbox contention keeps scope ownership

Status: Accepted — M18.11 / AT-03 prerequisite correction

Context

An unchanged concurrent client regression failed during AT-03 profiling. On Darwin, a nonblocking MSG_PEEK can return EAGAIN on the socket reader lock while the valid mailbox magic is still queued. Treating that result as inactive can lose the scope. Retrying only the second peek does not fix initial contention. Apple's soreceive acquires the reader lock before checking queued data; the local probe observed eight queued bytes at exactly this failure. This is host evidence, not Linux qualification.

Decision

Before treating an initial would-block peek as inactive, distinguish queued readiness from an empty socket. Darwin Rust clients use pinned nix's event feature and an owned kqueue with numeric descriptor registration. They do not adopt ownership of the inherited descriptor or change its flags. Only the newly owned queue gets CLOEXEC. Native C uses nonblocking poll. Readiness errors fail closed. Readable contention retries under the original absolute control budget; a second-peek would-block after prefix proof also retries within that budget.

Keep the exact magic, datagram-boundary, stream refusal and loss-marker checks. Genuinely empty unmarked endpoints remain inactive; marked missing endpoints remain failures. Native lease/bootstrap preparation, probing and request/reply share their caller's deadline; no fresh budget begins after a retry.

Consequences

The descriptor protocol/frame format does not change. No new crate, Rust unsafe, global flags, permission exception or fallback ownership path is introduced. Maintained injected tests cover both peeks, empty endpoints, readiness errors and deadline expiry. Bounded host stress corroborates them but does not become a costly probabilistic gate. AT-03 remains incomplete until its revised combined candidate passes review, profiling and the full gcc gate.