Skip to content

Fix proxy cleanup after client disconnect - #30928

Merged
XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/30276-30278-proxy-cleanup
Oct 25, 2026
Merged

XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/30276-30278-proxy-cleanup

Conversation

@iamlinjunhong

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

#30276
#30278

What this PR does / why we need it:

PR #30299 fixed the authorization contracts for KILL and processlist visibility. When the returned two-CN plus Proxy acceptance script was rerun, those checks passed, but force-closing a client during a running SELECT SLEEP(60) left the backend session in processlist beyond the ten-second acceptance window.

This PR closes the captured backend generation before sending the existing bounded best-effort DisconnectSession notification. It also treats plain EOF/connection-end errors with an in-flight client request as client disconnects, while preserving the explicit server-disconnect boundary. That closes the path missed by PR #30299 without changing its authorization behavior.

Validation

  • Native CGo focused proxy tests and race tests for close-before-notify, migration sealing, plain in-flight EOF, and idle EOF.
  • Native frontend KILL authorization/generation/self-disconnect tests.
  • Native table-function processlist visibility test.
  • Real two-CN plus MatrixOne Proxy PyMySQL acceptance, including cross-user KILL/processlist checks and changed-user force-close cancellation.
  • make cgo NATIVE_BUILD_JOBS=4 and make build NATIVE_BUILD_JOBS=4.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

Addressed the acceptance-evidence request and the helper-goroutine assertion feedback in commit f7e19e5477eb8ec574577d3058b18fe7545477f8.

  • Ran the updated session_authorization.py twice against the same clean production build of head 5e88f3fb2c54a6b6450404c85d3616364958b95a, with two CNs, the actual Proxy (-with-proxy) and conn-cache-enabled = true. Both complete invocations returned PASS and exit 0.
  • Force-close during observable SELECT SLEEP(60), after COM_CHANGE_USER and for the unchanged-root control, removed the complete backend processlist row in 0.000740–0.113975 seconds. Both CNs were covered. Fixture cleanup and owned-service termination completed successfully.
  • Added a tracked acceptance record containing build/source hashes, effective topology, commands, stdout and exit statuses. Documented the required launch flag and retained an initial non-Proxy diagnostic separately.
  • Moved require.Same to the test goroutine through a buffered observation channel. Focused normal test, focused race test plus 100 repeated race executions, go vet ./pkg/proxy and incremental lint passed. Independent final review found no blockers.

Production behavior is unchanged by this follow-up. Existing exact-head CI evidence remains applicable to the production closure; the public disconnect acceptance above supplies the previously missing proof.

@XuPeng-SH

XuPeng-SH commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: f7e19e5477eb8ec574577d3058b18fe7545477f8

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: f7e19e5477eb8ec574577d3058b18fe7545477f8

Assessment: approve

Reviewed all five changed files and the cleanup, migration, cache and CN callers. Closing the captured backend before notification preserves existing ownership and removes the transport’s dependency on RPC completion, without adding normal query-path work. The prior acceptance-evidence and test-assertion concerns are addressed.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Verified frozen HEAD, clean source, complete patch identity and diff whitespace.

  • Reconciled current-head CI jobs 121005465653 and 121005496129: native proxy package race tests and normal coverage completed successfully. Verified commands, terminal results and artifact hashes.

  • Isolation preflight passed. Verified 200 native inputs and 62 retained artifact hashes against the completed build-owner receipt.

  • TestDisconnectCleanupClosesBackendBeforeNotification passed locally under race detection once and then for 100 repetitions using the supplied executor.

  • Audited the tracked author acceptance record: its script hash matches current source, and production/build inputs match the recorded binary revision. Two complete runs covered changed-user and unchanged-root force-closes, both CNs and cache-enabled Proxy operation; reported backend-row disappearance was 0.000740–0.113975 seconds.

  • Command/source/exit receipts and retained logs reconcile successfully in attempt-1/evidence-audit.log and evidence-manifest.json.

Limitations:

  • Public acceptance results are retained author evidence; this reviewer did not rerun the live cluster. The referenced raw macOS build/config/service-log bundle was unavailable locally.

  • The plain-EOF test covers defensive helper behavior; production pipe errors are tagged.

  • No throughput benchmark was required: changes affect teardown, with no added healthy SELECT/DML/DDL work. Reported cleanup timings are not a controlled base/head benchmark.

@mergify mergify Bot added the queued label Oct 24, 2026
@mergify

mergify Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-24 23:38 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-25 04:26 UTC · at 863ce2d0670204b6fefa3162db93a622fc9d14f3

This pull request spent 4 hours 48 minutes 33 seconds in the queue, with no time running CI.

Reason

Pull request #30928 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

This branch had an error being deployed

1 failed deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants