fix(frontend): fence session reset from active requests - #26497
Open
VioletQwQ-0 wants to merge 1 commit into
Open
fix(frontend): fence session reset from active requests#26497VioletQwQ-0 wants to merge 1 commit into
VioletQwQ-0 wants to merge 1 commit into
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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
issue #20022
What this PR does / why we need it:
Proxy can observe a terminal MySQL response and start
ResetSessionwhile theoriginal CN
RoutineManager.Handleris still completing response accountingand defers. The old lifecycle controller serialized reset/migration/close, but
did not serialize ordinary requests, so reset could close the old Session,
process, and transaction handler while Handler still owned them.
This change:
ResetSessionfail fast with the existing busy error while a requestis active, so Proxy discards that backend and reconnects;
existing cancel-without-request-wait behavior;
the routine;
ExecRequestpanic recovery safely handle a nil transaction handler.Proxy cache/generation/in-flight production logic is unchanged.
Regression evidence
4959b7cdd853923f60b168d9ef69e242a1cadc37TestRoutineManagerResetSessionRejectsRequestAfterResponseWritefailed:reset returned
nilafter the terminal response write while Handler wasdeliberately blocked before returning.
af17db6b3db4b19cf5b4a604395574ce21a4a602Session/proc/TxnHandler and SessionManager entry, then succeeds once after
Handler exits and serves the next
COM_PING;rejected Proxy cache entry, and nil-TxnHandler recovery paths pass.
Validation
.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/frontend -count=1: PASS.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/proxy -count=1: PASSpkg/frontendandpkg/proxywith-race -count=1: PASS-race -count=100: PASSgo build -mod=readonly ./pkg/frontend ./pkg/proxy: PASSgo vet -mod=readonly ./pkg/frontend ./pkg/proxy: PASSgit diff --check: PASSPASS review=PASS validation=PENDINGProxy Compose BVT, pessimistic launch BVT, and coverage.
Local deployment evidence
The local topology was launched with the real Proxy path
(
mo-service -with-proxy), 2 CNs, and true new client connections.isolated 5 s context deadline; all Proxy/CN probes passed;
0 failures, all 36 endpoint probes passed, and backend sessions converged
from 119 to 17/18 rather than growing with total connections;
wait active, orcreateTxnOpUnsafewas observed in these valid runs.A malformed first result was observed in two cold-start runs immediately after
ports opened. A later diagnostic run without s2c batching passed 5,984 queries,
but it ran after the cluster was fully warm and therefore does not prove a
buffering defect. This cold-start observation is tracked as unresolved
acceptance evidence and is not used to justify an unrelated Proxy code change.
The complete 10-minute local soak is still pending: the initial 100
connections/s setup exhausts the macOS loopback ephemeral-port range, while
the later 50 connections/s rerun was interrupted by the local disk safety
threshold. TKE validation remains pending.
QA / BVT
independent true short connections. Deterministic Frontend/Proxy concurrency
tests provide the in-repo regression coverage.
connections for 10 minutes at a host-safe connection rate;
no panic/restart/continuous login failure, and bounded backend sessions.
phase/testingforAriznawlllto runthe deployment matrix; link
matrixorigin/mo-nightly-regression#835for therecurring short-connection coverage.