Skip to content

fix(morpc): preserve live unary requests during idle GC - #29586

Merged
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
LeftHandCold:fix/morpc-idle-inflight-29582
Oct 3, 2026
Merged

mergify[bot] merged 3 commits into
matrixorigin:mainfrom
LeftHandCold:fix/morpc-idle-inflight-29582

Conversation

@LeftHandCold

@LeftHandCold LeftHandCold commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • BUG
  • Improvement
  • Test and CI

Which issue(s) this PR fixes:

Fixes #29582

What this PR does / why we need it:

MORPC idle GC can close a healthy connection while an accepted unary RPC is still waiting for its response. Unary requests do not lock the backend, and heartbeats intentionally do not refresh business activity. In #29582, the CN received backend connection closed after approximately 59 seconds, while the TN completed the five-minute checkpoint later.

Recheck idle eligibility under the existing backend state and Future-map locks. A live ordinary unary Future prevents idle sealing. Seal request/stream admission before scheduling existing bounded asynchronous cleanup, so a previously selected handle cannot admit work after GC. Preserve completed/canceled/deadline cleanup, stream locks, draining ownership and pool accounting when cleanup slots are full. No new occupancy counter, worker, timer, retry path or public interface is introduced; the Future scan runs only for aged candidates.

The CI follow-up repaired the prepared-authorization fixture's stale call to a retired table-only helper using the active object-scoped helper with objectTypeTable. The latest main now owns the identical fixture correction, so it is no longer an additional file in this PR's diff. All authorization assertions remain, and the retired production wrapper remains removed.

ISCP lease validation now uses the executor callback's logical row count across batches. A valid constant vector can represent two rows with one physical string: the old reader incorrectly accepted that as one runner. Reject multiple logical rows before copying data, copy only the single runner, and reject NULL/empty runners. Existing transaction/result cleanup and system-account execution remain unchanged. Consolidate the reader tests into nine orthogonal cases while reducing that test file by two lines.

Validation

Local platform: darwin/arm64, Go 1.26.4, independently built matching native libraries via make cgo; tests use .agents/skills/mo-dev/scripts/mo-cgo-test with LC_ALL=C LANG=C.

  • Original author reproduction: real Unix socket on pre-fix main failed because GC collected the backend despite a healthy pong and live request; no-GC and draining controls passed. Only business activity time was aged.
  • New real-socket two-request case: finishing one request preserves the outstanding survivor; the final response permits idle collection before its Future is closed. Exact TestIdleGCPreservesPendingUnary race repetitions (-count=100) passed, 10.374s. Full MORPC normal suite passed, 13.180s. Original unchanged admission-order race100, MORPC race and txn/rpc normal/race evidence remains applicable.
  • Three prepared-authorization suites passed, 2.738s; full frontend suite passed, 24.177s. After the author's main merge, the three authorization suites passed again at current head 23665adc, 1.905s.
  • Valid two-row constant-runner counterexample failed before the ISCP correction (returned cn0 without error). Final nine reader cases and GetTaskRunner system-account/result-cleanup test passed, 0.731s; full ISCP suite passed, 0.833s.
  • Exact TestIssue29400DropDatabaseRCReclaimFailureRollsBackWholeDatabase passed after the reader correction, 38.48s, including original consumer progress and rollback assertions. Before this correction, the full shared issues sequence passed in 175.272s; predecessor/restore and 12 update/flush-generation probes also passed. Those experiments establish local behavior, not the Linux failure's attribution.
  • Selected-package molint passed; repository-configured golangci-lint 2.6.2 (Go 1.26.4) passed with 0 issues; formatting and diff checks passed.
  • gpt-6.1-sol / xhigh produced the design and reviewed the complete final change. The review was reconciled after the author's main merge and approved the actual five-file PR diff at head 23665adc; final review evidence is recorded outside tracked source.

Limits and CI

The original Linux CI also failed the DROP DATABASE test's initial consumer-progress wait. Its ISCP lease checks repeatedly reported unexpected rows count: 8192. This was not reproduced in the local exact test, full shared sequence or persisted-version probes. The independently proven constant-vector cardinality defect is fixed, but it is not claimed to explain that original large-count error. Rebuilt ordinary Linux CI now verifies current behavior; any recurrence still needs its actual logical result cardinality traced.

At head 23665adcb02b615de7b2858ad332898fcf3ef189, rebuilt CI run 37120631020 completed successfully: shared build, ordinary Ubuntu/x86 UT, Linux/arm64 SCA, coverage producer/merge, proxy multi-CN BVT, pessimistic multi-CN BVT and CI Required. Nonapplicable skipped modes are not passed evidence. The ordinary Linux UT job checked out this exact head and reports TestIssue29400DropDatabaseRCReclaimFailureRollsBackWholeDatabase pass, 19.98s; its terminal report has no failed UT cases. This closes the previous CI acceptance hold, not the historical 8192 attribution.

The prior follow-up run was canceled after the author merged main and is not passing evidence. This change does not optimize TN flushing or eliminate the genuine 90-second force-flush deadlines also present in the incident. No nightly/TKE rerun, data corruption, introducing commit or 4.2 backport is claimed. Wire/storage formats and request deadlines remain unchanged.

@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 →

Count executor logical rows before accepting the ISCP task runner and
reject NULL/empty or multiple runners without materializing a column.
Consolidate the reader cases and preserve result cleanup on partial init.

Use the active object-scoped helper in the prepared authorization fixture.
Challenge MORPC idle GC with two outstanding requests and prove collection
after response completion independently of Future.Close.
@LeftHandCold

Copy link
Copy Markdown
Collaborator Author

CI investigation and independent re-review

I checked the raw logs and diagnostic artifacts from run 37112110311, then preserved the newly published 0351159607 follow-up and merged current main (8daed14755). Updated head: 23665adcb02b615de7b2858ad332898fcf3ef189.

What failed

  • SCA / UT compilation / coverage producer: pkg/frontend/prepared_explain_test.go:272 still called getSqlForCheckRoleHasTableLevelPrivilege, removed by refactor(sql): consolidate active owners and retire obsolete paths #29574. I reproduced this exact compiler error on the clean pre-PR base b210a0a5fc. Main Optimize packed DATETIME to Decimal128 conversion #29581 and the preserved follow-up both contain the same object-scoped test-helper correction. This is not a MORPC compile regression.
  • Coverage merge: blocked because a required producer did not publish a complete profile. There was no patch-coverage percentage verdict to fix by padding tests.
  • Additional ordinary UT failure: TestIssue29400DropDatabaseRCReclaimFailureRollsBackWholeDatabase timed out waiting for initial ISCP progress, before its DROP DATABASE fault injection. ISCP lease queries returned eight batches and repeatedly reported unexpected rows count: 8192; taskservice MySQL operations also timed out. This is more specific than a generic slow-runner diagnosis, but the origin of that large result is not established.
  • The original build and both BVT modes passed. MORPC also passed in the coverage artifact.

Review and validation

The MORPC change preserves live requests without changing request deadlines, adding a hot-path occupancy counter, or making physical Close synchronous under the GC lock. I rechecked lock order, admission sealing, cancellation, response completion, draining and saturated-cleanup ownership. The added two-request test covers completing one request while the other remains live, and cleanup after the final response before Future.Close.

The ISCP follow-up fixes a real, separate logical-cardinality defect: a two-row constant vector stores only one physical string, which the old reader could accept as one runner. That proof must not be presented as proof of the original 8192-row CI failure. Both versions reject a normal flat result containing 8192 logical rows.

Independent final-head checks on darwin/arm64, Go 1.26.4, matching native libraries and matrixone_test:

Validation Result
Prepared authorization regression, six subtests PASS
All six TestIssue29400* integration tests PASS, 39.811s
Original failing DROP DATABASE test within that group PASS, 29.18s
Full MORPC package, -race PASS, 13.746s
Full txn/rpc package, -race PASS, 4.200s
Full ISCP package, -race PASS, 1.204s
Diff whitespace and clean worktree PASS

The exact DROP DATABASE case also passed on the old clean base locally (38.46s); this does not establish Linux/shared-suite equivalence. No timeout increase, skip or assertion weakening was used. No further code-review blocker was identified, but the rebuilt Linux UT result remains a merge gate. If the large-count error recurs, it needs its actual result cardinality and shared-fixture state traced, rather than another increase of the readiness budget.

@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.

Reviewed the complete five-file diff at 23665adcb02b615de7b2858ad332898fcf3ef189 against base 8daed14755ff13a81356085455cd14facb61049f, including existing owners/callers, admission ordering, Future recycling, cancellation/close paths, cleanup saturation, lease consumers, and test orthogonality. This round used no subagent.

No new confirmed code blocker was found. The MORPC correction reuses the existing state/Future-map ownership and bounded cleanup path; it does not add a parallel occupancy tracker or per-message work. ISCP correctly counts logical rows, preserves fail-closed multiple-owner behavior, and copies the sole runner before result cleanup. The socket/order scenarios and consolidated ISCP cases prove distinct boundaries. Production net +44, tests net +251, tracked documentation unchanged; test growth was reviewed independently.

One acceptance item remains open: the original ordinary Linux UT failed TestIssue29400DropDatabaseRCReclaimFailureRollsBackWholeDatabase before DROP fault injection while lease checks reported unexpected rows count: 8192. The proven constant-vector defect undercounts two logical rows; it is not causal proof of that large-count failure. Darwin integration/race passes and Linux coverage success do not establish equivalence to the original ordinary Linux/shared-suite mode.

Before approval, record the terminal result of the rebuilt ordinary Linux UT in run 37120631020. If the same consumer failure recurs, capture its logical batch cardinality/vector shape and trace upstream or shared-fixture state, then fix and validate the demonstrated cause. Do not hide it with LIMIT/DISTINCT, timeout extensions, skips, or weaker assertions. A green rerun establishes current CI behavior, not retroactive proof of the original 8192 cause. Linux SCA and applicable BVT checks must also complete successfully before merge.

At submission, shared build and Linux coverage producer are successful; ordinary Linux UT, SCA and both applicable BVT jobs are still running. The earlier compiler-helper issue is repaired and now base-owned. There are no unresolved inline review threads; the author's CI-investigation comment explicitly leaves the 8192 attribution/ordinary Linux verification open.

Requesting changes for this outstanding acceptance evidence only; no additional MORPC/ISCP redesign or speculative code change is requested.

@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.

APPROVE at 23665adcb02b615de7b2858ad332898fcf3ef189. This supersedes my earlier evidence-only request changes: the code, complete five-file diff and relevant validation inputs remain unchanged, and its outstanding Linux acceptance gate is now satisfied.

  • Ordinary Ubuntu/x86 UT job111195995188 checks out this exact head. Its terminal test report records TestIssue29400DropDatabaseRCReclaimFailureRollsBackWholeDatabase PASS in 19.98s, with no failed UT cases. This is the original ordinary-UT/shared-package mode, not substituted coverage or Darwin evidence.
  • Current-head CI run37120631020 also passes shared build, Linux arm64 SCA, coverage producer/merge, proxy multi-CN BVT, pessimistic multi-CN BVT and CI Required. Skipped modes are not claimed as passed.
  • Whole-change review reconciles the existing backend-state/Future ownership, GC/admission ordering, cancellation/completion reclamation, draining/stream policy and bounded cleanup with the logical-cardinality ISCP reader, result/transaction cleanup and orthogonal regression cases. No unresolved material code/design/test blocker remains; no speculative extra patch or redundant rerun is needed.

Limits remain explicit: the separately reproduced constant-vector undercount does not explain the historical8192 rejection. Green CI establishes current behavior, not historical causality. This fix does not optimize TN flushing, extend genuine checkpoint budgets, replay accepted requests, or promise measured throughput improvement. Recurrence of8192 requires bounded logical-row/vector-shape evidence and upstream attribution; do not hide it with LIMIT/DISTINCT, skipped assertions or increased timeouts.

Fresh issue-to-pr design and final whole-change reconciliation both passed using explicitly selected gpt-6.1-sol / xhigh through the supported read-only Codex CLI. Actual model/effort were verified from both rollout turn contexts. No subagents were invoked in this closure round.

No merge performed.

Post-merge deep-review reconciliation — 2026-10-03

Rechecked this unchanged head after Mergify merged it as ff4468a7849c986cc1e320317e88869edd53cd27. Its parent is the reviewed base, and the entire squash tree equals the reviewed head. All five changed files were reread and existing validation remains valid. Main session only, no subagent or delegated review this round. No new confirmed material blocker; maintain APPROVE. No extra fix PR is justified by this review.

Audit Closure
Q1 ownership Existing Future references/recycling, backend Close owner/join, result and transaction cleanup remain coherent; no new duplicate destruction owner.
Q2 waits GC uses the existing lock order and keeps physical I/O outside pool/state locks; queue stop/cancel and socket/deadline terminal edges remain intact. No added lock cycle.
Q3 growth Bounded cleanup slots and pool accounting remain; no new accumulating container. Not a claim that all callers or forgotten Futures are globally bounded.

QA challenged response completion while another request survives, admission before/after GC, cancellation/deadline, cleanup saturation, fresh activity, locked streams, and constant representation versus logical row count. Existing named socket/order/reader cases provide distinct oracles, including the survivor's real response and multirow rejection. Implementation net+44, tests net+251, tracked docs0 were reviewed separately; reader tests retain all four old oracles in nine compact cells, with no weakened assertions or new cluster. The aged-candidate O(F) scan and scalar lease reader are proportional; no dead new field, parallel tracker, needless state machine, or measured-throughput claim.

All actionable earlier review requests are closed; inline threads totalCount0. Historical8192 attribution remains unproven rather than falsely declared fixed. The post-merge TKE run37125415288 is still running and is not counted as passed. No source edit, redundant test rerun, CI restart or merge action in this round.

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

mergify Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-03 13:12 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-10-03 13:12 UTC · at ff4468a7849c986cc1e320317e88869edd53cd27 · squash

This pull request spent 10 seconds in the queue, including 1 second running CI.

Required conditions to merge

@mergify
mergify Bot merged commit ff4468a into matrixorigin:main Oct 3, 2026
@mergify mergify Bot removed the queued label Oct 3, 2026
LeftHandCold added a commit that referenced this pull request Nov 9, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue #32157 (first batch only; keep the tracking issue open)

## What this PR does / why we need it:

Backport six focused startup, RPC, and memory-lifetime fixes onto
`4.2-dev@02fcfbc`. These old paths are
still present on that release baseline. This is deliberately not a bulk
backport of the tracking issue's 30 entries and is not release approval.

| Source PR | Backported behavior | Failure/compatibility boundary |
| --- | --- | --- |
| #30761 | Hand off a first-catalog-replay disconnect to the existing
reconnect owner; do not publish readiness while paused. |
Before/during/after replay handoff, retry and cancellation, then actual
SQL after recovery. No Main worker-lifecycle refactor. |
| #29586 | Preserve live user-unary Futures during idle GC and
atomically seal admission when truly idle. | Heartbeats do not keep idle
connections alive; completed/canceled work can be reclaimed; saturated
cleanup remains capacity-accounted. Retains the source PR's
logical-row-count/NULL correction in `readSingleTaskRunner`. |
| #29559 | Claim FIN in the existing stream entry without holding its
mutex over synchronous send; release rejected responses once. | Writer
exit, full queue, invalid/duplicate FIN and later requests; update the
CN drop-release callback at the same ownership boundary. |
| #30536 | Public session close disconnects transport; only the writer
finalizer or failed-start path releases the writer's Goetty reference. |
Active Encode/Flush, blocked socket output and failed writer startup;
tested together with FIN. |
| #28384 | Detach address-keyed ownership/profile state before off-heap
realloc can recycle the old address; restore it if allocation fails. |
No change to accounted allocation or allocate-copy-free ownership paths;
allocator failure and address reuse are explicit oracles. |
| #29352 | Drop a completed non-constant Scope's Reader reference after
pipeline cleanup. | The existing TableScan/Pipeline owner still closes
the Reader; no additional Close call; prepared reuse must rebuild/read
correctly. |

Each source retains an independent `cherry-pick -x` commit.
Release-adaptation commit `72fb70919a9b98213af778cc7a4d6525e97dd7c4`
uses 4.2's existing Future predicate and queue instrumentation rather
than importing unrelated Main machinery. The real first-replay
regression uses 4.2's existing `pkg/embed` cluster owner, with
process-wide faults isolated in a dedicated test package, and also
checks real MySQL prepared-statement reuse.

### Scope and design review

- No wire, catalog or persisted-data format changes, new configuration,
external dependency versions, SQL optimization rules, or background
cleanup subsystem.
- MORPC and mpool are shared code: their changes also affect other roles
that use them, not only CN. Excluding TN storage/WAL changes is not a
claim that TN executes no changed code.
- Resource ownership remains with the existing Pipeline, RPC writer,
client cleanup pool, allocator and connector. FIN adds one terminal bit
to an existing live stream entry; replay adds one notification channel
per connector, not a second recovery state machine.
- Idle GC scans existing Futures only after the idle-age check; it does
not add per-request bookkeeping. The other changes replace cleanup
ordering or remove references. No throughput improvement or
zero-regression guarantee is claimed.
- Q1: response/Future/transport/Reader cleanup owners checked, including
rejected admission and failed startup. Q2: FIN no longer holds the
receive-state lock over send completion; disconnect interrupts socket
I/O; first replay wakes the existing reconnect path. Q3: no new growing
registry or queue; bounded backend cleanup is retained.

### Deliberately not included

- #29725: 4.2 already enters allocator recovery on Unlock errors; Main's
bypass guard is absent. Do not label this as the same confirmed
release-branch Unlock leak.
- #29448, the NULL-completeness subset of #29558, and #28693 remain
follow-up candidates with separate
authentication/planner/transaction-helper validation; absence here does
not mean they are unimportant.
- The TN/WAL, mixed-lock, HNSW and ISCP task-lifecycle changes need
dedicated adaptation and upgrade/recovery coverage. CDC already has
#32232; do not duplicate it. No rollback/upgrade of any running cluster
is part of this PR.

### Tested with

Original backport validation:
`72fb70919a9b98213af778cc7a4d6525e97dd7c4`. Local runs used Go 1.26.4,
Darwin arm64, native libraries built from this release tree,
`GOMAXPROCS=2`, `-p=1` and normally `GOMEMLIMIT=2GiB`. Earlier
pre-commit runs retain their working-tree identity; their relevant
source content matches that original validation commit. No historical
Main test result is presented as a test of this backport.

| Evidence | Result |
| --- | --- |
| MORPC, mpool, ISCP, compile and disttae owning packages | Normal and
race PASS. |
| CN owning package | Normal and race PASS with the
environment-sensitive scalar memory-limit test split as described below;
all tests in that partition covered. |
| New real embed regression | Normal and race PASS: inject disconnect
during first catalog replay, recover startup, observe a fresh TN
timestamp, and execute one actual MySQL prepared statement twice with
results `[1,2]`, then `[2]`. The dedicated test package isolates faults
from the shared embed cluster. |
| Existing `TestSingleCNCluster` | Race PASS. |
| Linux amd64 on server 50 | Both Linux-only realloc tests PASS in
normal/race; full mpool (71 top-level tests) and MORPC (315 top-level
tests) normal/race PASS. |
| Matched Linux baseline controls | Clean `02fcfbc898` plus only
regression probes reproduces three real failures: stale metadata at
allocator-cache publication, queued-FIN close deadlock, and buffers
freed during active Encode. Candidate passes the same oracles. The
baseline physical-allocation-failure test already passes and is retained
as compatibility coverage, not claimed as a new failing counterexample.
|

Linux used existing immutable build image
`sha256:44069beb9d61e8d1d6766f1d214eb94843257616bc8c9291ee53fae1edbbd7fa`,
fresh candidate/base native builds and separate source/cache
directories. Containers had 2 CPUs, 4 GiB memory+swap limit, 512 PIDs
and no network. Existing services on 50 were not changed.

The first capped full CN runs failed
`Test_service_handleGoMemLimit/set_4Gi`: that test assumes the initial
Go memory limit is `MaxInt64`, but the explicit test environment
supplied 2 GiB. The exact capped case on clean baseline `02fcfbc898`
fails with the same expected-MaxInt64/actual-2147483648 signature. We
did not weaken its assertion or change product code. The package is run
with that one case excluded under the cap, and the exact scalar-only
case is separately run in normal/race with `GOMEMLIMIT` unset. Original
failed receipts remain failed.

Stress: 21 individually selected MORPC/mpool/compile/disttae cases
passed independent `-race -count=100` runs on Darwin. The isolated embed
recovery case passed its proportional repeat (`T=17.25s`, `B=30s`,
`N=1`). Linux cache-publication retirement passed `-race -count=100`;
physical allocation failure passed `-race -count=29` (`T=1.03s`,
`B=30s`). Selections are non-empty and recorded by individual test name.

Commands use the repository CGo wrapper, with serial package builds:

```sh
GOMAXPROCS=2 GOMEMLIMIT=2GiB .agents/skills/mo-dev/scripts/mo-cgo-test -p=1 -count=1 -timeout=240s ./pkg/common/morpc ./pkg/common/mpool ./pkg/iscp ./pkg/sql/compile ./pkg/vm/engine/disttae
GOMAXPROCS=2 GOMEMLIMIT=2GiB .agents/skills/mo-dev/scripts/mo-cgo-test -p=1 -race -count=1 -timeout=240s ./pkg/common/morpc ./pkg/common/mpool ./pkg/iscp ./pkg/sql/compile ./pkg/vm/engine/disttae
# CN package: normal/race separately, then the one default-limit oracle separately.
GOMAXPROCS=2 GOMEMLIMIT=2GiB .agents/skills/mo-dev/scripts/mo-cgo-test -p=1 -count=1 -skip '^Test_service_handleGoMemLimit$' ./pkg/cnservice
env -u GOMEMLIMIT GOMAXPROCS=2 .agents/skills/mo-dev/scripts/mo-cgo-test -p=1 -count=1 -run '^Test_service_handleGoMemLimit$' ./pkg/cnservice
# Also repeated with -race; each stress command selects exactly one test.
# Original test path at 72fb; the follow-up moves it to ./pkg/embed/firstreplay.
GOMAXPROCS=2 GOMEMLIMIT=2GiB .agents/skills/mo-dev/scripts/mo-cgo-test -p=1 -race -count=1 -timeout=240s -run '^TestCNFirstReplayDisconnect$' ./pkg/embed
```

`go vet` passed for all seven affected production/test packages; `git
diff --check` passed. Incremental golangci-lint was **not validated**:
locally installed versions are incompatible with the repository's v2
config/Go 1.26 toolchain. No lint configuration or dependencies were
changed to bypass this limitation. No full BVT, production workload
benchmark or rolling-upgrade qualification is claimed; PR CI and release
qualification remain separate.

### Incidental bug findings

`pkg/tests/service.buildCNConfig` on the target baseline validates a
newly generated CN UUID before registering its service runtime, causing
a nil-runtime panic before the cluster starts. This is already addressed
upstream by #30380 (`0723ae37b1`); disposition: **Duplicate / not
included**. The new regression uses the existing embed fixture, which
already registers the runtime and catalog definitions. It does not patch
or claim validation of the legacy service fixture, and does not pull in
the broader CN-drain changes from #30380.

Ordinary off-heap profiling has a separate pre-existing
enable/allocate/disable/free boundary: the pool returns to zero but the
profile pointer/in-use sample remains recorded. An isolated baseline
probe reproduced it; disposition: **Created #32334 / not included**.
This is diagnostic metadata retention, not a demonstrated native-buffer
leak or customer OOM, and does not change this batch's scope or review
conclusion.



### CI test follow-up

Follow-up commit: `6404268dae8b5d78a12fb0459b67991c8893a9cd`.

After the 4.2-dev merge,
[UT](https://github.com/matrixorigin/matrixone/actions/runs/42341756945/job/128310805969)
and
[coverage](https://github.com/matrixorigin/matrixone/actions/runs/42341756945/job/128310839394)
exposed a process-admission deadlock in `TestCNFirstReplayDisconnect`:
the shared embed fixture held the runner-wide lock while its test
process waited for a child that needed the same lock. Move the existing
recovery test into its own test package, remove the recursive
subprocess, and acquire the existing process admission before starting
replay deadlines. Fault injection remains process-isolated, and the real
fresh-TN-timestamp and two prepared-execution result oracles are
retained.

The coverage run also failed an existing dropped-user authorization
assertion across two CNs. The reader uses its locally applied statement
snapshot, so the test now fences the committed DROP and verifies through
independent CN1 SQL that the user is absent before checking that the
already-authenticated session is denied. This establishes denial after
visibility; it does not claim instantaneous cross-CN revocation or prove
the precise cause of that CI failure. The unmodified 4.2-dev baseline
passed three normal repetitions.

Follow-up validation on Linux/amd64, Go 1.26.4, matching branch-local
native libraries:

- The original full-order reproduction fails on `6c7dca5d` after the
shared cluster starts; the independent test passes with the same lock
held by another process for over 40 seconds, then released, including
under `-race`. A separate cancellation control confirms admission times
out before faults or a cluster start.
- Complete `pkg/embed` and `pkg/embed/firstreplay` suites run together
with `-p=2`: PASS (230.547s and 17.923s). Existing process-admission
exclusivity, reentrancy and cancellation tests also pass under `-race`.
- Full `TestIssue29399AuthorizationScopeAndRevokedRole`: three normal
repetitions and one `-race` run pass, including the CN1 public-SQL
visibility and retained-session denial checks.
- Scoped CI-style `-tags matrixone_test -short -covermode=set` execution
of both scenarios passes with cnservice, MORPC, mpool, ISCP, compile,
disttae and frontend instrumented. This is not the full CI coverage
producer.
- Incremental gofmt and `go vet` pass for the affected packages;
repository-configured golangci-lint 2.6.2 built with Go 1.26.4 reports 0
issues for the follow-up diff. The original backport diff passed arm64
SCA on `6c7dca5d`.
- Independent design: `gpt-6.1-terra/max`. Independent overall review:
`gpt-6.1-sol/max`, no material code blocker; final evidence reconciled
before delivery.

The follow-up changes only tests; it adds no production hot-path work.
Full post-push CI and release/upgrade qualification are separate and are
not claimed as passed here.

---------

Co-authored-by: XuPeng-SH <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
ci — 23665adc Deployed Oct 3, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MORPC idle GC closes in-flight unary checkpoint RPCs before their request deadlines

3 participants