Repository navigation
A client reaches only a server it may use; an orphaned server exits (0.6.2) - #32
Merged
Merged
Conversation
…0.6.2 A server reports its launch (code root, starting process, audience) in every heartbeat. A client connects to a server it started only if that server reports the launch it was handed, and attaches to another only if the code root matches and the audience admits the client process. A server whose starting process is gone stops: owner-only at once, any-session once idle. ZMQConfig.socket_root owns where socket and lock files live, and TransportDeclaration.private_endpoint gives a caller an address of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
OpenHCS surface B7. A client attached to whatever answered at an address, and nothing stopped a server whose starter was gone.
What changes
EndpointLaunch(code root, the process that started it, audience) and reports it in every heartbeat (PongResponse.launch).EndpointAudienceis a registered family:OwnerOnlyAudience(a non-persistent server) andAnySessionAudience(a persistent one). The wire carries the registry name.ZMQClient.launch()is what a client hands the server it starts. After the start, the client connects only if the ready server reports exactly that launch. On a mismatch it stops its own child and leaves the other server's socket files alone.connectat an occupied address,connect_existing), a local server must report a launch, its code root must equal the client's, and its audience must admit the client process. Otherwise the client raisesEndpointLaunchMismatchError, which names the address and the reason. A remote host is not compared: its paths and process ids mean nothing on this machine.ZMQServer.process_messageschecks its owner once a second. When the owner is gone, an owner-only server cancels its work and stops; an any-session server stops once it has no running or queued execution.ZMQConfig.socket_root()owns where socket and lock files live (~/.<app_name>by default; both transports read it). An application overrides it to keep installations apart.TransportDeclaration.private_endpoint(config)gives a caller an address of its own: a new socket directory for IPC, the first unbound pair for TCP.code_root()on clients and servers defaults to the directory the class's top-level package is imported from. An application with a declared import root overrides it on both.Callers must change
_spawn_server_processimplementation must passself.launch()to the server it starts (EndpointLaunch.to_argument/from_argumentfor a command line), or the client refuses the server.TransportDeclarationmust implementprivate_endpoint.Nothing public is removed, so this is 0.6.2. Not tagged or released here.
Not changed:
connectstill kills the listener of an unresponsive TCP address before starting its own server (_kill_processes_on_port). That process may belong to someone else.Tests
tests/test_endpoint_launch.py(10 tests, real server processes): two servers from two code roots and a client refused at the other's address; an owner-only server refuses another process and a persistent one admits it; a server that reports no launch is refused; a server exits after its owner is killed (both audiences); a persistent orphan finishes its work first.Local run: 383 passed, 2 skipped, 2 failed. The 2 failures are
test_ack_return_routeIPC cases whose socket path under my long--basetempexceedssun_path; both pass with a short one.🤖 Generated with Claude Code