Repository navigation
fix(proof): never take the socket from a busy read server - #287
Draft
tonyketcham wants to merge 1 commit into
Conversation
`proof serve` probes its socket before it starts, and takes the socket over when nothing answers. The probe gave up after two seconds. But a server building a large graph, such as the benchmark's 10x graph, blocks for six to nine seconds, so a second server took its socket and left the first one running and unreachable. A dead socket refuses the connection at once, while a busy server accepts it and replies late. The probe now counts a timeout as a live server. A new test holds a socket with a server that never replies, and checks that `serveProofReads` refuses it. The test fails without the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DVVnhYL1Bz7mCfEKDoyLMW
5 of 8 tasks
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.
Summary of changes
This is layer 7 of a stack. It sits on #286.
proof servekeeps a Proof graph in memory and answers reads on a Unix socket. Before it starts, it probes the socket, and it takes the socket over if nothing answers. The probe gave up after two seconds. But a server building a large graph, such as the benchmark's 10x graph with 4,980 records, blocks for six to nine seconds. During that build, a second server read the silence as a dead socket, took it over, and left the first server running but unreachable.This turned up during two benchmark runs started 20 seconds apart. The second run's server was refused only because the first had just finished building.
The fix rests on one difference. A dead socket refuses the connection at once. A busy server accepts it and replies late. So the probe in
packages/flatbread/src/cli/serve.tsnow counts a timeout as a live server.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
serve.test.tsholds a socket with a server that accepts connections but never replies, and checks thatserveProofReadsrefuses to take it. It fails against the old probe. All 4 serve tests pass, and so doespnpm typecheck.Does this introduce any non-backwards compatible changes?
Does this include any user config changes?
Generated by Claude Code