Repository navigation
Description
Summary
The Ubuntu/x86 unit-test job for PR #28139 failed on one unrelated, race-sensitive logservice test. The PR's changed production and test files do not include pkg/logservice; the exact failing function's runtime call path is the logservice connect/close path and does not invoke the changed IVFFLAT/ObjectIO symbols.
- Source PR: perf(ivfflat): fuse filtered include index reads #28139
- PR head:
7ae4090054c8747dd05a069f546495b5a595f785 - Check:
Matrixone CI / UT Test on Ubuntu/x86 - Workflow run: https://github.com/matrixorigin/matrixone/actions/runs/34183828404
- Failed job (attempt 1): https://github.com/matrixorigin/matrixone/actions/runs/34183828404/job/101928119853
- Failed step:
Unit Testing
Failure
The workflow ran make ut UT_CONFIGURED=1 UT_PARALLEL=8 UT_TIMEOUT=40 UT_SHARD=all. Its race stages use -mod=readonly -vet=off -short -v -json -tags matrixone_test -race.
The only failed package was github.com/matrixorigin/matrixone/pkg/logservice. The stable signature was:
[TEST]: TestConnectToLogServiceAddressesClosesSuccessfulLosers
client_test.go:349: expected: "first", actual: "second"
WARNING: DATA RACE
Write: pkg/logservice/client_test.go:305
Previous read: pkg/logservice/client.go:587
--- FAIL: TestConnectToLogServiceAddressesClosesSuccessfulLosers
testing.go:1712: race detected during execution of test
The full failed-job log was inspected with gh run view 34183828404 --log-failed; no compile, static-analysis, or changed-package failure was reported. The job completed its other setup and post-processing stages and exited with go test failed with status 1 followed by process exit code 2.
Comparison evidence
The exact test selection was non-empty. With the repository mo-cgo-test wrapper, -race, -short, -tags matrixone_test, CGO_ENABLED=1, and one process with -count=3:
- PR head
7ae4090054c8747dd05a069f546495b5a595f785: pass, 3/3. - Clean official
up/mainb2f0f3fe69b23cde495c59d226c647aba555cfdc: pass, 3/3.
Focused command:
.agents/skills/mo-dev/scripts/mo-cgo-test -race -vet=off -short -tags matrixone_test -p 8 -count=3 -timeout 120s -run '^TestConnectToLogServiceAddressesClosesSuccessfulLosers$' ./pkg/logservice
The PR diff's Go packages are pkg/objectio, pkg/objectio/ioutil, pkg/vectorindex/ivfflat, pkg/vectorindex/sqlexec, pkg/vm/engine, pkg/vm/engine/readutil, and pkg/vm/engine/tae/blockio; the exact failing logservice connect/close path does not call changed symbols.
Reproduction and impact
- Check out PR head
7ae4090054c8747dd05a069f546495b5a595f785. - Use the repository's CGo test wrapper and the focused command above, or run the full CI-equivalent
make ut UT_CONFIGURED=1 UT_PARALLEL=8 UT_TIMEOUT=40 UT_SHARD=allwith thematrixone_testrace configuration. - Observe the nondeterministic ordering assertion and race report in
pkg/logservice.
This blocks the PR's Ubuntu/x86 UT check when the race window occurs. No product-code change is proposed in this issue; the purpose is to track and triage the test race/flaky assertion.
Planned validation
The failed run will be rerun once with gh run rerun 34183828404 --failed after this issue is recorded. The rerun result will be compared by the same check, job, test name, and race signature.
Activity
aron-intframe commentedon Sep 8, 2026
The flake is in the test, not in
pkg/logservice.client_test.go:349asserts an ordering thatconnectToLogServiceAddressesnever establishes, and theWARNING: DATA RACEis a consequence of that assertion failing, not a second independent bug. That is why PR #28139 is innocent and why-count=3on an idle box passes on both revisions.1.
expected: "first", actual: "second"require.Equal(t, "first", readCalledAddress(t, called))assumes the two attempt goroutines reachcalled <- addrin launch order. Nothing enforces that. The loop launches"first", then launches"second"onelogServiceConnectFallbackDelaylater — and the test sets that delay to1 * time.Millisecond. A 1 ms head start is not a happens-before edge. Under-racewithUT_PARALLEL=8on a loaded runner, goroutine"first"can sit in a run queue longer than 1 ms and"second"sends first.2. The data race is caused by #1
require→t.FailNow()→runtime.Goexit(), which immediately runs the deferred restore registered atclient_test.go:305(connectToLogServiceAddressFn = origConnect). At that moment the goroutine that calledconnectToLogServiceAddressesis still alive andclose(release)(line 351) has not run, so both attempt goroutines are still parked inside the stub, having already read that same package-level var atclient.go:587. Write at 305 vs previous read at 587 — exactly the pair in the CI log. NoteconnectToLogServiceAddressesdoeswg.Wait()on every return path, so nothing leaks on the passing path; the leak exists only after the assertion aborts the test goroutine.How I checked
I could not build the tree here (no CGo toolchain), so I lifted
connectToLogServiceAddresses,closeUnusedConnectResultClientsandstopConnectFallbackTimerverbatim into a standalone module plus a faithful copy of the test, withrequire.Equalreplaced byt.Fatalf(sameFailNow/Goexitsemantics). Line mapping: myclient.go:48= upstreamclient.go:587, myclient_test.go:47= upstream305, myclient_test.go:95= upstream349.2 ordering failures in 25600 iterations, and exactly 2 data races — the race never fired without the ordering assertion failing first. The stack trace above shows the causal chain directly: the write at 305 happens inside
runtime.Goexit()called fromtesting.(*common).Fatalfat 349.3. A third flake in the same test, 36x more frequent (72 / 25600)
assert.Equal(t, 1, closeCount)(upstream ~line 365) can see0. After the winner's result is received,connectToLogServiceAddressescallscancel(). The losing attempt may still be parked in the stub'sselect { case <-release: case <-ctx.Done(): return nil, ctx.Err() }. Oncecancel()lands, both cases are ready and Go picks uniformly at random, so the loser returns an error instead of a*client— there is no connection to close andcloseCountstays 0 (thengot 1instead of2on the next assert). Run 3 above confirms it: every occurrence had exactly one loser attempt aborted by the winner'scancel(). This one hasn't bitten the Ubuntu/x86 job yet, but it is the same test and it is more likely than the race you filed.Fix (test-only, no production change)
With those three, the same 64 x 400 = 25600 race iterations gave 0 failures and 0 race reports (run 4 above). Item 3 alone is worth applying to every test in this file that swaps
connectToLogServiceAddressFnorlogServiceConnectFallbackDelay:TestConnectToLogServiceAddressesFallsBackand the hanging-address test at 265-284 have the same shape, so any future assertion failure there will also be reported as a data race and send triage after the wrong file.A test that only passes because the scheduler happened to cooperate is a green tick that isn't evidence; that failure family is the whole subject of our own catalog (ours): https://github.com/aron-intframe/agent-guards
fix(logservice): make fallback test deterministic (#28406)
fix(logservice): make fallback test deterministic (matrixorigin#28406)
fix(logservice): make fallback test deterministic (matrixorigin#28406)
fix(logservice): make fallback test deterministic (matrixorigin#28406)