Repository navigation
[4.2-dev] fix(morpc): preserve slow responses after probe timeout - #26931
Conversation
(cherry picked from commit aa11c18)
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep reviewed exact head 7ad71ac33b6175870800af03b52db6354a979836 against 4.2-dev base 43aa6ff892d7970110134b0167eaadca34d762bc.
Backport integrity:
- Source commit:
aa11c18f2a3d6a2609eaa425ae50b51ce72c321ffrom #26903. - Source and backport have the identical stable patch ID
e5ca098d573ea36e9bc1a1446ccfdb68d5cbede7. - Both modified files have identical preimage/postimage blobs; no conflict resolution or semantic rewrite occurred.
- The untouched MORPC client, GC, Future, types, and lockservice RPC/remote consumer blobs are also identical to the source commit's baseline, so the draining-generation protocol has the same consumers on
4.2-dev.
Lifecycle closure:
- A data inactivity timeout seals admission under
stateMubefore the independent control probe, so new traffic cannot enter the old generation after publication. - Probe failure remains inconclusive and no longer schedules reset/fails all Futures; the old generation retains ownership until a late response, request deadline/Future close, terminal data error, explicit reset, or client/backend close.
- EOF, connection reset, broken pipe, and other non-timeout data errors still bypass preservation and take the immediate reset/failure path.
- New traffic uses a replacement generation. Pool growth remains bounded to
maxBackendsPerHost + 1; when another generation drains, the oldest drain is retired before another replacement is admitted, and cleanup concurrency is separately bounded.
Unhappy-path audit:
- Q1: Future/response/backend cleanup ownership remains exactly once across late response, timeout, reset, and close.
- Q2: probe wait is bounded by
min(readTimeout/5, internalTimeout)and is outside backend locks; cancellation and terminal data errors retain independent termination paths. - Q3: pending liveness IDs remain buffer-bounded, draining generations remain pool-bounded, and saturated cleanup keeps backends counted against capacity.
Performance: the normal request/response path is unchanged. The only reordered lock/CAS work is on the response-inactivity fault path; no per-request allocation, lock, RPC, or scan was added.
Fresh validation on the backport head:
- Modified regression measured under race:
T=0.03s, budgetB=30s, adaptiveN=100; passed. - Nine focused liveness/draining/generation tests:
-count=30; passed. - Full
pkg/common/morpcrace: passed. - Full
pkg/lockservice/...: passed (105.908s). - MORPC + lockservice build and vet: passed.
- PR CI is green and the head is mergeable.
No blocking correctness, lifecycle, deadlock, boundedness, compatibility, or performance finding.
Merge Queue Status
This pull request spent 43 seconds in the queue, including 2 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #26888.
Backport of #26903 to
4.2-dev.What this PR does / why we need it:
Backports the MORPC fix that prevents an inconclusive control-probe timeout from resetting a data backend that can still return valid slow Lock responses.
The #26888 incident occurred on
4.2-dev: one failed probe closed the shared backend and failed all pending Lock Futures together as ErrorCode 20505. The lock owner returned those responses shortly after the caller had already closed the connection.This change affects only the response-inactivity path:
The normal MORPC request/response path does not add locks, allocations, or RPCs.
Backport verification
-xfromaa11c18f2a3d6a2609eaa425ae50b51ce72c321f.-count=30passed.TestTimedOutLivenessProbePreservesSlowDataResponse: race-count=100passed.go test ./pkg/common/morpc/...passed.go test -race ./pkg/common/morpcpassed.go test ./pkg/lockservice/...passed.