Repository navigation
Description
Is there an existing issue for the same bug?
- I searched open and closed issues for
TestServiceBootstrapRestoresHAKeeperAndWAL,addWALRecoveryStatus, and the reported race locations; no matching issue exists.
Branch Name
main
Commit ID
Observed on PR head 1e72b8fc371475ed4db93d2e7600d33b6918ea0b; the failing LogService code and test are unchanged by that PR and match its base.
Other Environment Information
- GitHub Actions workflow:
MatrixOne ALL CI - Job:
Matrixone CI / UT Test on Ubuntu/x86 - Runner:
amd64-mo-shanghai-8c16g-92mgx-runner-5v7t5 - Workflow run attempt: 2
- Failing job: https://github.com/matrixorigin/matrixone/actions/runs/30807956392/job/91681914442
Actual Behavior
The race detector fails pkg/logservice.TestServiceBootstrapRestoresHAKeeperAndWAL because the test mutates the service's plain walRecovery.coordinator field while the live heartbeat worker reads it:
WARNING: DATA RACE
Write at ... by goroutine ...:
pkg/logservice.TestServiceBootstrapRestoresHAKeeperAndWAL()
pkg/logservice/service_bootstrap_test.go:165
Previous read at ... by goroutine ...:
pkg/logservice.(*Service).addWALRecoveryStatus()
pkg/logservice/wal_recovery_status.go:50
pkg/logservice.(*Service).heartbeat()
pkg/logservice/service_commands.go:248
pkg/logservice.(*Service).heartbeatWorker()
pkg/logservice/service_commands.go:186
NewService derives walRecovery.coordinator from configuration before starting the heartbeat worker, and production code does not mutate that role afterward. The test enables workers, then changes the field directly at lines 153 and 165 to reuse one live service for non-coordinator and coordinator restart scenarios. This violates the field's immutable-after-start ownership contract and races the heartbeat status read.
Expected Behavior
The test should exercise coordinator and non-coordinator restart behavior without mutating immutable service role state while background workers are running. Race-enabled LogService tests should complete without a detector report while preserving all existing recovery assertions.
Steps to Reproduce
-
Run the focused test repeatedly with the race detector, preferably under runner load:
.agents/skills/mo-dev/scripts/mo-cgo-test -race \ -run '^TestServiceBootstrapRestoresHAKeeperAndWAL$' \ -count=10 -timeout=600s ./pkg/logservice -
When a heartbeat reads recovery status after either direct test assignment, observe the race between
service_bootstrap_test.go:153or:165andwal_recovery_status.go:50.
Additional information
- A single focused local race run passed in 32.825 seconds, consistent with the heartbeat-dependent scheduling window; the CI race report identifies both conflicting accesses and their goroutine creation stacks.
- The field and test were introduced together by commit
4f761829b847db116b84b211ee6924303c4fd140in PR logservice: support offline WAL recovery #25867. - The workflow is already on attempt 2, so it must not be rerun again for this PR.
- The failure is unrelated to PR test(gc): make deleter concurrency check deterministic #26644, whose diff changes only
pkg/vm/engine/tae/db/gc/v3/deleter_test.go.
Activity