Range-lock conflicts can strand waiters in stale queues A waiter that moves to a new…
- User
Range-lock conflicts can strand waiters in stale queues
A waiter that moves to a new range conflict must no longer remain in stale queues. Cleanup must preserve unrelated lock state, wake the next eligible waiter when necessary, and continue to work when the previous key disappeared or was recreated.
Interface
No new interfaces are introduced.
- Assistant
Now let me check where
waiterQueueimplementations exist and look at thelockContext/waiter_events.go: - Assistant
Let me look at the test helpers and
waiter_events.gocontext struct: - Assistant
Now rework
handleLockConflictLocked: - Assistant
Build and vet pass. Now let me add tests. First, check the existing test file's imports and the test added by #24051:
- Assistant
Now add the tests. First the queue-level test in
waiter_queue_test.go: - Assistant
Now add the integration test and the recreated-key unit test to
lock_table_local_test.go: - Assistant
The test passes even on the old code — the spurious self-notification may not strand txn4 the way I predicted. Let me check
setBlockedand re-analyze: - Assistant
The test reproduces the stranding on pre-fix code (txn4 hangs until deadline) and passes with the fix. Now run the full lockservice suite for regressions:
- Assistant
Full suite passes. Let me check for flakiness in the new/related tests with
-race: - Assistant
The implementation is complete and verified. Summary of the fix:
Problem
When a range-lock waiter conflicts at key A, blocks, gets notified, retries, and then conflicts at a different key B, the old cleanup in used , which:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.