Repository navigation
test(rpc): make the connection-cap test wait until the hog holds the slot - #77
Conversation
…slot connection_cap_refuses_the_surplus_connection still failed on main after #76. The port race was gone; this failure was a second race inside the test. The readiness client's slot is freed asynchronously on the server, so the raw "hog" connection could arrive while that slot was still counted. The server then refused the hog itself, and the "surplus" client got the free slot and succeeded. The test now checks that the hog really holds the slot before it tries the surplus client. A refused hog reads EOF; a hog holding the slot reads nothing, because the server is waiting for its handshake. The test reconnects until the hog holds the slot. This replaces the fixed 500 ms sleep. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JMTyE9inRv7Knv6jkmgDZs
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Retry raw connections until the slot is held crates/scylla-rpc/tests/remote.rs |
The test imports ErrorKind and Read. It retries raw TCP connections after EOF or another read result, and detects a held connection slot with a read timeout. The test fails if no attempt holds the slot within 10 seconds. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Merge Risk: 
Low · up to 24ae0
-
The test can remain flaky or validate surplus-connection behavior before the hog actually occupies the slot.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed -
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Cause
connection_cap_refuses_the_surplus_connectionfailed again on main after #76 merged (run 40124250632, on 955ec61). #76 removed the port race, so this failure came from a second race inside the test.The test runs the server with
SCYLLA_RPC_MAX_CONN=1. First, a readiness client runsinfoand exits. Then the test opens a raw, silent "hog" connection to fill the one slot, sleeps 500 ms, and expects the next client to be refused. The problem is that the server frees the readiness client's slot asynchronously, when its connection task ends. If the hog arrives before that, the server sees the slot still taken and drops the hog itself. The slot then frees, and the "surplus" client gets it and succeeds (exit 0).Fix
The test now checks that the hog really holds the slot before it tries the surplus client. A refused hog reads EOF right away. A hog that holds the slot reads nothing, because the server is waiting for its handshake (10 s by default), so the read times out. The test reconnects the hog until the read times out, with a 10 s deadline. This replaces the fixed 500 ms sleep. The assertion itself is unchanged.
Only
crates/scylla-rpc/tests/remote.rschanges.Ran
cargo fmt --allcargo clippy --workspace --all-targets -- -D warnings: cleancargo test --workspace --locked: all passcargo test -p scylla-rpc --test remote --locked, 20 runs: 0 failurescargo test -p scylla-rpc -p scylla-graphql -p scylla-serve --locked, 3 runs: all passProudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/
🤖 Generated with Claude Code
https://claude.ai/code/session_01JMTyE9inRv7Knv6jkmgDZs