fix(network): add the time the broker may hold a request to its timeout #559
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 298 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.341
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #559"
general
weight: 0.35
ShogunPanda
Fixes #558
Fetch, ShareFetch and JoinGroup requests can be held by the broker before it answers: a fetch for up to
maxWaitMswhen there is no data, and a JoinGroup for up to the rebalance timeout. The connection timed them with the flatrequestTimeout, so arequestTimeoutbelow that wait timed them out and destroyed the socket.context.brokerWaiton their writer, like Produce setscontext.noResponse. JoinGroup v0 has no rebalance timeout, so it uses the session timeout.requestTimeoutplus itsbrokerWait, capped at 2^31 - 1 ms. Node fires a timer after 1 ms when its delay is above that.docs/base.mdexplains it undertimeoutvsrequestTimeout.One side effect: a JoinGroup to a coordinator that stops answering now takes up to
requestTimeoutplus the rebalance timeout to fail, since that is how long the broker may hold it.How I checked it, on a single broker:
| Case | main | this PR |
| ------------------------------------------------------------------- | -------------------------------------- | ------------------------------- |
| Idle topic,
requestTimeout: 3000,maxWaitTime: 5000| stream errors at 15.0 s, 4 disconnects | alive after 25 s, 0 disconnects || Join behind a killed member (60 s session),
requestTimeout: 10000| fails after 43.1 s | joins at 60.0 s, 0 disconnects |New tests:
Connection.sendaccepts a response that arrives afterrequestTimeoutbut within the broker wait. It times out at 500 ms on main.requestTimeoutplus the broker wait (1.5 s here, 0.5 s on main).requestTimeoutof 2^31 - 1 plus a broker wait does not time out after 1 ms.requestTimeout: 1000andmaxWaitTime: 2000has no errors or disconnects after 4.5 s, then gets a new message. Fails 3 of 3 on main, passes 3 of 3 here.brokerWait.I couldn't run
test/network/connection.test.tsas a whole locally, since its setup needs the SASL brokers, so the new test there ran on its own.