Skip to content

[Bug]: lockservice handoff UT races with keeper while replacing proxy.remote #32260

Closed

Description

@ck89119

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Searched for the exact test name, proxy.remote, and localLockTableProxy race; no matching open issue was found.

Branch Name

issue-32014-main (PR #32230); the affected pkg/lockservice tree is identical to main at the base commit below.

Commit ID

  • Failing CI: bd623d55c358f0f453acbe06497569bb217ca169
  • Verified main base: 007dd57a6192a6fb7348e45a973fb784d2d5ae67

Other Environment Information

Actual Behavior

TestProxySurvivorUnlockReleasesLostHandoffHolder fails with two race reports. The test directly replaces a published proxy's remote interface while the background keeper may read it:

WARNING: DATA RACE
Read:
  (*localLockTableProxy).getBind                 lock_table_proxy.go:565
  (*lockTableKeeper).keepIdleRemoteRoutes       idle_route.go:84
  (*lockTableKeeper).keepRemoteLock             lock_table_keeper.go:142
Previous write:
  TestProxySurvivorUnlockReleasesLostHandoffHolder.func1
                                                lock_table_proxy_test.go:1212

A second report reads the newly published recordingUnlockTable through its embedded getBind() while racing with the test's initialization at line 1211. The reported test duration was 1.68s, at approximately 2026-11-05 13:07:06–13:07:08 UTC.

Expected Behavior

Fault injection and recording in the test should not race with background service tasks. Publication and access must have a valid synchronization relationship; passing quickly before the keeper runs is not a synchronization guarantee.

Steps to Reproduce

With matching native artifacts, run the exact test under the race detector:

GOTOOLCHAIN=go1.27.1 .agents/skills/mo-dev/scripts/mo-cgo-test \
  -race -count=100 -timeout=120s \
  -run '^TestProxySurvivorUnlockReleasesLostHandoffHolder$' ./pkg/lockservice

Reproduction limit: this command passed 100 repetitions on the clean local main baseline; the single-test race measurement was only 0.02s. The observed failure is the linked CI run, not a claimed local reproduction. The keeper uses a periodic timer, so the much shorter local execution does not establish safety.

Additional information

  • git diff main <failing-sha> -- pkg/lockservice is empty; PR fix(plan): push outer pagination into derived-table sorts #32230 changes planner/compile pagination and SQL regressions, not this lockservice test or keeper.
  • Both CI race reports identify the test's mutable remote-wrapper injection/publication, not a SQL pagination call path.
  • Please make the injection safe for concurrent keeper access (for example, a stable wrapper with properly synchronized test controls), rather than adding sleeps, suppressing race detection, or locking only the write while leaving readers unsynchronized.
  • The failed UT job is being rerun separately; rerun success would not resolve this race report.

Activity

  1. added
    kind/bug
    on Nov 5, 2026
  2. XuPeng-SH commented on Nov 6, 2026

    @XuPeng-SH
    Contributor

    Implemented in the single consolidated PR #32307, commit eb75f951585da1e7d2a3e232fb4b407ac00282d5.

    The fixture now installs one stable Unlock wrapper before publishing the remote proxy. Synchronized controls inject lost requests/responses without replacing proxy.remote after publication; all five related real-owner handoff/retry scenarios are preserved. No production mutex or timing workaround was added. The original issue-named test also runs a concurrent published-table/getBind scan; deliberately restoring one unsafe interface write makes that exact test fail with a race report.

    The same 690 lockservice tests passed in normal and race modes. All 18 changed concurrency roots passed their separate measured-budget race commands (1,597 repetitions total). Thirteen existing rolling-restart scenarios reuse the short-mode heartbeat setting and retain all state/error assertions, reducing the matched local full-package race sample from 58.668 to 42.592 seconds. Incremental vet, pinned molint and configured golangci-lint passed. CI for the pushed revision is pending; keep this issue open until the containing PR merges.

  3. added a commit that references this issue on Nov 6, 2026
    606ae4f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugneeds-triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions