Repository navigation
A local endpoint's cleanup spares its successor by an ownership token, not dev/ino (card 005e1676) - #5544
Merged
joelteply merged 2 commits intoOct 27, 2026
Conversation
…, not dev/ino (card 005e1676) local_stream::Owned::remove decided whether the endpoint was still its own by the socket's (dev, ino). Linux reuses an inode number at once, so a predecessor's cleanup removed its successor's socket: a_live_owner_is_refused_and_an_old_cleanup_spares_its_successor failed at mod.rs:134 on canary 107af91 and on every PR's host job (#5543 at cbba67a). Now each bind writes a fresh ownership token (pid, clock, per-process count) to the custody sidecar, under custody, and Owned keeps it. remove deletes the socket only while the sidecar still holds that token, then clears it; a successor's bind writes its own, so a late predecessor cleanup spares it whatever inode the socket got. A crashed owner's leftover token is harmless: the next binder reclaims the stale endpoint and writes its own. The custody wait stays bounded (2 ms poll, 2 s ceiling). The successor test no longer depends on inode reuse, so it is deterministic on every OS: 60 of 60 stress runs pass on macOS; Linux is CI's. Taken back from Fable: part a (#5533) is my code. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…replacement is spared as well as a successor (Codex on #5544) The token alone (ee9c615) let an old owner's cleanup remove whatever replaced its socket outside custody: a regular file, a symlink, or a listener that never wrote the sidecar. Owned now keeps the socket's (dev, ino) again beside the token, and remove deletes the path only while it is still a socket with that identity AND the sidecar holds this bind's token: the identity spares any replacement, the token a successor whose socket reused the inode number. Test: an_old_cleanup_never_removes_what_replaced_its_socket (a regular file and a symlink at the path survive the old cleanup). Proven by mutation: with the identity check removed it fails ("a regular file at the path survives"). The token's doc no longer claims absolute uniqueness; the stale Owned doc is fixed. Host: 10 lib + 1 integration pass, 60/60 stress. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply
deleted the
005e1676/a-local-endpoint-s-cleanup-spares-its-su
branch
October 27, 2026 23:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
local_stream::Owned::remove decided whether the endpoint was still its own by the
socket's (dev, ino). Linux reuses an inode number at once, so a predecessor's
cleanup removed its successor's socket:
a_live_owner_is_refused_and_an_old_cleanup_spares_its_successor failed at
mod.rs:134 on canary 107af91 and on every PR's host job (#5543 at cbba67a).
Now each bind writes a fresh ownership token (pid, clock, per-process count) to
the custody sidecar, under custody, and Owned keeps it. remove deletes the socket
only while the sidecar still holds that token, then clears it; a successor's bind
writes its own, so a late predecessor cleanup spares it whatever inode the socket
got. A crashed owner's leftover token is harmless: the next binder reclaims the
stale endpoint and writes its own. The custody wait stays bounded (2 ms poll,
2 s ceiling). The successor test no longer depends on inode reuse, so it is
deterministic on every OS: 60 of 60 stress runs pass on macOS; Linux is CI's.
Taken back from Fable: part a (#5533) is my code.
Co-Authored-By: Claude Opus 5.5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE