Skip to content

net: a busy node closes gently, so a client that spoke first still reads Busy on Linux - #285

Merged
cjus merged 2 commits into
mainfrom
claude/busy-graceful-close
Nov 17, 2026
Merged

cjus merged 2 commits into
mainfrom
claude/busy-graceful-close

Conversation

@cjus

@cjus cjus commented Nov 17, 2026

Copy link
Copy Markdown
Owner

A busy node told a client so, then closed straight away. A client that had already sent a request (Solrac's connection check sends initialize as soon as it is connected) left that request unread in the node's socket, so closing made the kernel send a reset, and Linux drops the data a client hasn't read yet when a reset arrives: the Busy line was lost and Solrac read "Connection reset by peer (os error 104)". macOS keeps the line, so this only showed in Solrac's Linux nightly (an_engine_serving_another_client_is_busy, cjus/chessgui).

  • a_client_that_speaks_first_still_reads_busy (crates/net/tests/tls.rs): a second approved client sends initialize at once, waits 300 ms, then must read Busy. The first commit adds it alone, to show it fail on Linux CI.
  • The fix (next commit): after Busy, the node ends its side gently (TLS close_notify, then shuts down writing only), reads and drops what the client sends until it hangs up or REFUSAL_TIMEOUT (1 s) passes, then closes. That wait is on a thread of its own, so the listener keeps accepting.

No functional change to search or evaluation; bench unchanged.

🤖 Generated with Claude Code

cjus and others added 2 commits November 17, 2026 11:17
Solrac's connection check sends initialize as soon as it is connected. A busy node closes
with that request unread, so the kernel resets the connection, and Linux drops the Busy
line the client hadn't read yet: Solrac's nightly CI read "connection reset by peer".
This test is expected to fail on Linux until the fix that follows.

No functional change.

Bench: 767812

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ads Busy

After Busy the node sends close_notify and shuts down writing only, reads and drops what
the client sends until it hangs up or REFUSAL_TIMEOUT passes, then closes, on a thread of
its own so the listener keeps accepting. Closing with the client's request unread made the
kernel reset the connection, and on Linux the client then lost the Busy line.

No functional change.

Bench: 767812

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cjus
cjus marked this pull request as ready for review November 17, 2026 18:24
@cjus
cjus merged commit f41bbcc into main Nov 17, 2026
1 check passed
@cjus
cjus deleted the claude/busy-graceful-close branch November 17, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant