fix: release RemoteRun stream after peer close#25791
Conversation
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.
Approved after a full RemoteRun/MORPC lifecycle review.
The change correctly separates receive-path closure from local Stream ownership release. A closed/nil receive now poisons backend reuse but still reaches exactly one sender-owned teardown through closeOnce and Stream.Close(true), which unregisters the stream and closes the unusable backend. The negotiated FIN/FIN_ACK success path remains unchanged and still uses Close(false) for reuse.
Unhappy-path closure checked:
- Q1: acquired Stream ownership reaches Close on receive close/nil, FIN failure, cancellation, malformed response, and legacy teardown; sender close is idempotent.
- Q2: peer-close and FIN_ACK waits terminate through channel closure/nil, context timeout, or backend shutdown; no new lock cycle was introduced across stream/backend cleanup.
- Q3: the fix removes stale activeStreams/futures retention and adds no unbounded state.
Fresh validation on head 9026feaad3:
- focused teardown/stream-closed tests:
-race -count=30; - full
pkg/sql/compilerace suite; - full
pkg/common/morpcrace suite; - dependent
TestTxnComputationWrapper_Runfrontend regression; go buildandgo vetforpkg/sql/compile.
Merge Queue Status
This pull request spent 1 hour 2 minutes 21 seconds in the queue, including 1 hour 2 minutes 4 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #25760
What this PR does / why we need it:
Testing