Skip to content

test(morpc): isolate control backend test from idle GC - #26651

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-26649-be36ab9d
Aug 3, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-26649-be36ab9d

Conversation

@gouhongshen

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:

Fixes #26649

What this PR does / why we need it:

Root cause

TestIndependentControlBackendPreservesSlowDataRequest configured a 1 ns client idle lifetime so its direct closeIdleBackends call would exercise the draining-backend guard. NewClient also registers that client with the process-wide idle-GC manager. Before the test's explicit liveness probe changes the data backend from running/admissible to draining, a global GC tick can therefore detach and close the backend while its first Future is still outstanding. The test then fails at the probe assertion, the pool assertion, or the replacement/original Future assertions depending on where GC wins.

Changes

  • Disable automatic idle GC for this lifecycle test with the documented zero idle-duration setting.
  • Keep the explicit closeIdleBackends assertion. A zero threshold still makes the backend eligible for that direct cleanup call if the draining protection is absent, so the assertion remains a strong regression oracle without an independent scheduler racing the setup.
  • Preserve the existing assertions for the independent control session, draining transition, replacement data generation, and completion of the original outstanding request.

Issue-to-test proof

  • TestIndependentControlBackendPreservesSlowDataRequest covers [Bug]: TestIndependentControlBackendPreservesSlowDataRequest races global idle GC #26649 end to end: establish an outstanding slow request, deterministically drive a successful independent probe, assert the old generation is draining and survives direct idle GC, create and verify a distinct replacement generation, then release and complete the original Future.
  • Before the change, MORPC_GC_IDLE_INTERVAL=1ms reproduced the reported backend_test.go:734: Should be true failure and adjacent backend-removal failures within 20 runs. After the change, the same accelerated mode passes 200 consecutive runs and 100 race-detector runs.
  • BVT is not applicable because this is an internal MORPC client/backend lifecycle unit test with no SQL-visible behavior.

Validation

  • MORPC_GC_IDLE_INTERVAL=1ms .agents/skills/mo-dev/scripts/mo-cgo-test -count=200 -timeout=120s -run '^TestIndependentControlBackendPreservesSlowDataRequest$' ./pkg/common/morpc
  • env -u MORPC_GC_IDLE_INTERVAL .agents/skills/mo-dev/scripts/mo-cgo-test -count=200 -timeout=120s -run '^TestIndependentControlBackendPreservesSlowDataRequest$' ./pkg/common/morpc
  • Focused race stress: measured T=0.03s, B=30s, N=100; accelerated-GC -race -count=100 passed.
  • env -u MORPC_GC_IDLE_INTERVAL .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=240s ./pkg/common/morpc
  • env -u MORPC_GC_IDLE_INTERVAL .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s ./pkg/common/morpc/...
  • GOWORK=off go list -mod=readonly ./pkg/common/morpc/...
  • GOWORK=off go build -mod=readonly ./pkg/common/morpc/...
  • GOWORK=off go vet -mod=readonly ./pkg/common/morpc/...

Residual risks

No production code, API, configuration default, or runtime behavior changes. This test intentionally owns the draining/idle-cleanup state transition through a direct call; the process-wide ticker and positive idle-expiration behavior remain covered by the dedicated client GC tests.

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

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

Deep review completed against 37b08ba.

The change preserves the intended oracle: explicit zero disables process-wide idle-GC dispatch for this client, while the direct closeIdleBackends call still treats an admission-eligible backend as immediately expired and therefore continues to prove the draining-generation guard.

Validation:

  • base d2378f0 reproduces the race under MORPC_GC_IDLE_INTERVAL=1ms
  • current head passes the focused test 200 times under the same accelerated GC
  • current head passes 50 focused race-detector iterations
  • full pkg/common/morpc package passes

No blocking correctness, lifecycle, or coverage issue found.

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

mergify Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-03 14:51 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-08-03 14:58 UTC · at 5095eccb85bd8918c23d19eca6246bc08cfb6261

This pull request spent 7 minutes 50 seconds in the queue, with no time running CI.

Waiting for
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]

Reason

Pull request #26651 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.

Failing checks:

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

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

Re-reviewed the current head 5095ecc after the Mergify main merge. The PR net patch has the same stable patch-id as the previously reviewed 37b08ba change, and the merge has no MORPC conflict resolution. On the exact new head, the accelerated-GC focused test passes 200 iterations and 20 race-detector iterations. Approval remains valid.

@XuPeng-SH
XuPeng-SH merged commit acfb8ef into matrixorigin:main Aug 3, 2026
22 of 24 checks passed
@mergify mergify Bot added dequeued and removed queued labels Aug 3, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…26651)

## What type of PR is this?

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

## Which issue(s) this PR fixes:

Fixes matrixorigin#26649

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

### Root cause

`TestIndependentControlBackendPreservesSlowDataRequest` configured a 1
ns client idle lifetime so its direct `closeIdleBackends` call would
exercise the draining-backend guard. `NewClient` also registers that
client with the process-wide idle-GC manager. Before the test's explicit
liveness probe changes the data backend from running/admissible to
draining, a global GC tick can therefore detach and close the backend
while its first Future is still outstanding. The test then fails at the
probe assertion, the pool assertion, or the replacement/original Future
assertions depending on where GC wins.

### Changes

- Disable automatic idle GC for this lifecycle test with the documented
zero idle-duration setting.
- Keep the explicit `closeIdleBackends` assertion. A zero threshold
still makes the backend eligible for that direct cleanup call if the
draining protection is absent, so the assertion remains a strong
regression oracle without an independent scheduler racing the setup.
- Preserve the existing assertions for the independent control session,
draining transition, replacement data generation, and completion of the
original outstanding request.

### Issue-to-test proof

- `TestIndependentControlBackendPreservesSlowDataRequest` covers matrixorigin#26649
end to end: establish an outstanding slow request, deterministically
drive a successful independent probe, assert the old generation is
draining and survives direct idle GC, create and verify a distinct
replacement generation, then release and complete the original Future.
- Before the change, `MORPC_GC_IDLE_INTERVAL=1ms` reproduced the
reported `backend_test.go:734: Should be true` failure and adjacent
backend-removal failures within 20 runs. After the change, the same
accelerated mode passes 200 consecutive runs and 100 race-detector runs.
- BVT is not applicable because this is an internal MORPC client/backend
lifecycle unit test with no SQL-visible behavior.

### Validation

- `MORPC_GC_IDLE_INTERVAL=1ms .agents/skills/mo-dev/scripts/mo-cgo-test
-count=200 -timeout=120s -run
'^TestIndependentControlBackendPreservesSlowDataRequest$'
./pkg/common/morpc`
- `env -u MORPC_GC_IDLE_INTERVAL
.agents/skills/mo-dev/scripts/mo-cgo-test -count=200 -timeout=120s -run
'^TestIndependentControlBackendPreservesSlowDataRequest$'
./pkg/common/morpc`
- Focused race stress: measured `T=0.03s`, `B=30s`, `N=100`;
accelerated-GC `-race -count=100` passed.
- `env -u MORPC_GC_IDLE_INTERVAL
.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=240s
./pkg/common/morpc`
- `env -u MORPC_GC_IDLE_INTERVAL
.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s
./pkg/common/morpc/...`
- `GOWORK=off go list -mod=readonly ./pkg/common/morpc/...`
- `GOWORK=off go build -mod=readonly ./pkg/common/morpc/...`
- `GOWORK=off go vet -mod=readonly ./pkg/common/morpc/...`

### Residual risks

No production code, API, configuration default, or runtime behavior
changes. This test intentionally owns the draining/idle-cleanup state
transition through a direct call; the process-wide ticker and positive
idle-expiration behavior remain covered by the dedicated client GC
tests.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…26651)

## What type of PR is this?

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

## Which issue(s) this PR fixes:

Fixes matrixorigin#26649

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

### Root cause

`TestIndependentControlBackendPreservesSlowDataRequest` configured a 1
ns client idle lifetime so its direct `closeIdleBackends` call would
exercise the draining-backend guard. `NewClient` also registers that
client with the process-wide idle-GC manager. Before the test's explicit
liveness probe changes the data backend from running/admissible to
draining, a global GC tick can therefore detach and close the backend
while its first Future is still outstanding. The test then fails at the
probe assertion, the pool assertion, or the replacement/original Future
assertions depending on where GC wins.

### Changes

- Disable automatic idle GC for this lifecycle test with the documented
zero idle-duration setting.
- Keep the explicit `closeIdleBackends` assertion. A zero threshold
still makes the backend eligible for that direct cleanup call if the
draining protection is absent, so the assertion remains a strong
regression oracle without an independent scheduler racing the setup.
- Preserve the existing assertions for the independent control session,
draining transition, replacement data generation, and completion of the
original outstanding request.

### Issue-to-test proof

- `TestIndependentControlBackendPreservesSlowDataRequest` covers matrixorigin#26649
end to end: establish an outstanding slow request, deterministically
drive a successful independent probe, assert the old generation is
draining and survives direct idle GC, create and verify a distinct
replacement generation, then release and complete the original Future.
- Before the change, `MORPC_GC_IDLE_INTERVAL=1ms` reproduced the
reported `backend_test.go:734: Should be true` failure and adjacent
backend-removal failures within 20 runs. After the change, the same
accelerated mode passes 200 consecutive runs and 100 race-detector runs.
- BVT is not applicable because this is an internal MORPC client/backend
lifecycle unit test with no SQL-visible behavior.

### Validation

- `MORPC_GC_IDLE_INTERVAL=1ms .agents/skills/mo-dev/scripts/mo-cgo-test
-count=200 -timeout=120s -run
'^TestIndependentControlBackendPreservesSlowDataRequest$'
./pkg/common/morpc`
- `env -u MORPC_GC_IDLE_INTERVAL
.agents/skills/mo-dev/scripts/mo-cgo-test -count=200 -timeout=120s -run
'^TestIndependentControlBackendPreservesSlowDataRequest$'
./pkg/common/morpc`
- Focused race stress: measured `T=0.03s`, `B=30s`, `N=100`;
accelerated-GC `-race -count=100` passed.
- `env -u MORPC_GC_IDLE_INTERVAL
.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=240s
./pkg/common/morpc`
- `env -u MORPC_GC_IDLE_INTERVAL
.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s
./pkg/common/morpc/...`
- `GOWORK=off go list -mod=readonly ./pkg/common/morpc/...`
- `GOWORK=off go build -mod=readonly ./pkg/common/morpc/...`
- `GOWORK=off go vet -mod=readonly ./pkg/common/morpc/...`

### Residual risks

No production code, API, configuration default, or runtime behavior
changes. This test intentionally owns the draining/idle-cleanup state
transition through a direct call; the process-wide ticker and positive
idle-expiration behavior remain covered by the dedicated client GC
tests.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…26651)

## What type of PR is this?

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

## Which issue(s) this PR fixes:

Fixes matrixorigin#26649

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

### Root cause

`TestIndependentControlBackendPreservesSlowDataRequest` configured a 1
ns client idle lifetime so its direct `closeIdleBackends` call would
exercise the draining-backend guard. `NewClient` also registers that
client with the process-wide idle-GC manager. Before the test's explicit
liveness probe changes the data backend from running/admissible to
draining, a global GC tick can therefore detach and close the backend
while its first Future is still outstanding. The test then fails at the
probe assertion, the pool assertion, or the replacement/original Future
assertions depending on where GC wins.

### Changes

- Disable automatic idle GC for this lifecycle test with the documented
zero idle-duration setting.
- Keep the explicit `closeIdleBackends` assertion. A zero threshold
still makes the backend eligible for that direct cleanup call if the
draining protection is absent, so the assertion remains a strong
regression oracle without an independent scheduler racing the setup.
- Preserve the existing assertions for the independent control session,
draining transition, replacement data generation, and completion of the
original outstanding request.

### Issue-to-test proof

- `TestIndependentControlBackendPreservesSlowDataRequest` covers matrixorigin#26649
end to end: establish an outstanding slow request, deterministically
drive a successful independent probe, assert the old generation is
draining and survives direct idle GC, create and verify a distinct
replacement generation, then release and complete the original Future.
- Before the change, `MORPC_GC_IDLE_INTERVAL=1ms` reproduced the
reported `backend_test.go:734: Should be true` failure and adjacent
backend-removal failures within 20 runs. After the change, the same
accelerated mode passes 200 consecutive runs and 100 race-detector runs.
- BVT is not applicable because this is an internal MORPC client/backend
lifecycle unit test with no SQL-visible behavior.

### Validation

- `MORPC_GC_IDLE_INTERVAL=1ms .agents/skills/mo-dev/scripts/mo-cgo-test
-count=200 -timeout=120s -run
'^TestIndependentControlBackendPreservesSlowDataRequest$'
./pkg/common/morpc`
- `env -u MORPC_GC_IDLE_INTERVAL
.agents/skills/mo-dev/scripts/mo-cgo-test -count=200 -timeout=120s -run
'^TestIndependentControlBackendPreservesSlowDataRequest$'
./pkg/common/morpc`
- Focused race stress: measured `T=0.03s`, `B=30s`, `N=100`;
accelerated-GC `-race -count=100` passed.
- `env -u MORPC_GC_IDLE_INTERVAL
.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=240s
./pkg/common/morpc`
- `env -u MORPC_GC_IDLE_INTERVAL
.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s
./pkg/common/morpc/...`
- `GOWORK=off go list -mod=readonly ./pkg/common/morpc/...`
- `GOWORK=off go build -mod=readonly ./pkg/common/morpc/...`
- `GOWORK=off go vet -mod=readonly ./pkg/common/morpc/...`

### Residual risks

No production code, API, configuration default, or runtime behavior
changes. This test intentionally owns the draining/idle-cleanup state
transition through a direct call; the process-wide ticker and positive
idle-expiration behavior remain covered by the dedicated client GC
tests.

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

This branch was previously deployed

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

Labels

kind/test-ci size/XS Denotes a PR that changes [1, 9] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: TestIndependentControlBackendPreservesSlowDataRequest races global idle GC

3 participants