Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
The closed issues #23581 and #26649 document related, test-specific races with the process-wide MORPC idle-GC loop, but neither tracks this test or assertion. Their corresponding test fixes do not cover TestGetBackendWithCreateBackend.
Branch Name
main
Commit ID
6fb0573b9d4b4ced0a0339e01cabec2a7e94f53c
Other Environment Information
- Workflow: MatrixOne ALL CI
- Job: Matrixone CI / UT Test on Ubuntu/x86
- Workflow run 33230446268, attempt 1, failed job 99042307493
- Runner: Ubuntu 22.04, Go 1.26.4, race-enabled repository UT wrapperActual Behavior
The Ubuntu UT job fails in pkg/common/morpc because TestGetBackendWithCreateBackend has a data race with the process-wide idle-GC goroutine. The failure is reported at:
WARNING: DATA RACE
Write: (*client).closeIdleBackends() at pkg/common/morpc/client.go:1873
Previous read: TestGetBackendWithCreateBackend() at pkg/common/morpc/client_test.go:1705
--- FAIL: TestGetBackendWithCreateBackend
testing.go:1712: race detected during execution of test
The test reads len(c.mu.backends["b1"]) after getBackend returns without holding c.mu. The global clientGCManager may concurrently run closeIdleBackends, which rebuilds the same backend slice and assigns it back into the map while holding c.mu. The test therefore races with a legitimate client lifecycle operation and intermittently fails the race-enabled UT job.
Expected Behavior
TestGetBackendWithCreateBackend should inspect the client backend state under the same mutex used by the client and idle-GC lifecycle, so the test remains race-free while preserving its backend-creation assertion.
Steps to Reproduce
-
Run the focused test under the race detector:
go test -race ./pkg/common/morpc -run '^TestGetBackendWithCreateBackend$' -count=100
-
Run the repository Ubuntu UT workflow or its race-enabled MORPC package phase on a runner where the process-wide idle-GC goroutine is active.
-
Observe the race report between
closeIdleBackendsand the directc.mu.backends["b1"]read.
Additional information
- Failing job: https://github.com/matrixorigin/matrixone/actions/runs/33230446268/job/99042307493
- The same workflow's
Matrixone UT Coverage / UT Coverage on Ubuntu/x86failure was independently traced to existing issue [Bug]: Concurrent CREATE SNAPSHOT statements bypass the configured feature quota #27718; the test(fileservice): release disk cache read vector #27830 diff does not touch MORPC. Matrixone Utils CI / Coveragefailed downstream because the required UT producer was not successful; it is not a separate root cause.- PR test(fileservice): release disk cache read vector #27830 changes only
pkg/fileservice/disk_cache_lifecycle_test.goand is unrelated to this MORPC test race.
Related historical fixes
- [Bug]:
TestCreateQueueFullFallbackDATA RACE #23581 / FixTestCreateQueueFullFallbackDATA RACE #23582: a different MORPC test read backend state outside the client lock and was corrected in that test. - [Bug]: TestIndependentControlBackendPreservesSlowDataRequest races global idle GC #26649 / test(morpc): isolate control backend test from idle GC #26651: a different lifecycle test was isolated from the process-wide idle-GC scheduler.
Activity
gouhongshen commentedon Aug 29, 2026
PR #27837 is trying to fix this issue.
gouhongshen commentedon Aug 29, 2026
PR #27837 has merged and is awaiting manual validation. The issue remains open.
gouhongshen commentedon Oct 21, 2026
Reproduction record: the same process-wide idle-GC race recurred in
TestMaybeCreateLockedWithNotFullBackendsAndNoBusy(no new issue filed; this closed issue is the standing record of this mechanism)b6110b0a52.TestMaybeCreateLockedWithNotFullBackendsAndNoBusyfailed withWARNING: DATA RACE/race detected during execution of test:Write ... by goroutine (test):runtime.mapassign_faststratTestMaybeCreateLockedWithNotFullBackendsAndNoBusy()—pkg/common/morpc/client_test.go:1484, the test assignsc.mu.backends["b1"] = []Backend{...}without holdingc.mu.Previous read ... by goroutine (idle GC):runtime.mapIterStartat(*client).doRemoveInactiveAll()—pkg/common/morpc/client.go:1836, called by(*clientGCManager).doGCInactivePeriodic()/runGCIdleLoop()from the process-wide GC goroutine started bymorpc.init.0viaensureStartedLocked.TestCreateQueueFullFallbackDATA RACE #23581/FixTestCreateQueueFullFallbackDATA RACE #23582, [Bug]: TestIndependentControlBackendPreservesSlowDataRequest races global idle GC #26649/test(morpc): isolate control backend test from idle GC #26651) — a test inspecting or mutatingc.mu.backendsoutside the client lock while the process-wideclientGCManageriterates it underc.mu. The merged per-test fix test(morpc): guard backend pool assertion against idle GC #27837 coveredTestGetBackendWithCreateBackend;TestMaybeCreateLockedWithNotFullBackendsAndNoBusyretains the unlocked write, so the class is unexhausted. A focused local run (go test -race -run '^TestMaybeCreateLockedWithNotFullBackendsAndNoBusy$' -count=200 ./pkg/common/morpc) passed on an unloaded machine, matching this class's narrow timing window (the background GC tick must overlap the one-line unlocked write); the CI race report is the captured evidence.pkg/defines,pkg/frontend,pkg/sql/planand BVT SQL/result files; its diff is empty forpkg/common/morpcagainst both its base (7038c8520e) and currentmain. The failed test, its unlocked write and the GC manager are all pre-existing main code.github.com/matrixorigin/matrixone/pkg/common/morpc; the same job passed the PR's ownpkg/frontendandpkg/sql/planpackages and all compose/e2e BVT checks in the same run). A single failed-jobs rerun of run 39599969113 was requested on 2026-10-21; if the race recurs, the unlocked test write atclient_test.go:1484(and its sibling tests in this family) needs the same one-line lock-coverage fix pattern as test(morpc): guard backend pool assertion against idle GC #27837.