Repository navigation
test(morpc): isolate control backend test from idle GC - #26651
Conversation
1567c2b to
37b08ba
Compare
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.
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.
Merge Queue Status
This pull request spent 7 minutes 50 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull 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.
Failing checks:
HintYou 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. Tick the box to put this pull request back in the merge queue (same as
|
XuPeng-SH
left a comment
There was a problem hiding this comment.
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.
…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>
…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>
…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>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #26649
What this PR does / why we need it:
Root cause
TestIndependentControlBackendPreservesSlowDataRequestconfigured a 1 ns client idle lifetime so its directcloseIdleBackendscall would exercise the draining-backend guard.NewClientalso 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
closeIdleBackendsassertion. 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.Issue-to-test proof
TestIndependentControlBackendPreservesSlowDataRequestcovers [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.MORPC_GC_IDLE_INTERVAL=1msreproduced the reportedbackend_test.go:734: Should be truefailure and adjacent backend-removal failures within 20 runs. After the change, the same accelerated mode passes 200 consecutive runs and 100 race-detector runs.Validation
MORPC_GC_IDLE_INTERVAL=1ms .agents/skills/mo-dev/scripts/mo-cgo-test -count=200 -timeout=120s -run '^TestIndependentControlBackendPreservesSlowDataRequest$' ./pkg/common/morpcenv -u MORPC_GC_IDLE_INTERVAL .agents/skills/mo-dev/scripts/mo-cgo-test -count=200 -timeout=120s -run '^TestIndependentControlBackendPreservesSlowDataRequest$' ./pkg/common/morpcT=0.03s,B=30s,N=100; accelerated-GC-race -count=100passed.env -u MORPC_GC_IDLE_INTERVAL .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=240s ./pkg/common/morpcenv -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.