Skip to content

test(lock): let every worker join the hold in the concurrent acquire test - #89

Merged
mattmattox merged 1 commit into
mainfrom
claude/lock-test-join-turn
Nov 13, 2026
Merged

mattmattox merged 1 commit into
mainfrom
claude/lock-test-join-turn

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

Test-only. This is the internal/lock -race flake the #81 author saw at .68 load. It showed up in a 3×50-run go test -race loop of internal/lock on main cddbaf5 on .66, once with -cpu 1.

TestConcurrentAcquireOnOneNodeKeepsOtherNodesOut has each worker hold the lock until all four have it. A node lets new holders join a hold for only HoldTurn (250ms). A worker that started later waits for the holders to drain, and the holders were waiting for that worker. Three workers gave up after 1s, blocked on their own node's claim.

  • With holdTurn at 1ms, main fails every run in iteration 1. With this change it passes.
  • At the real turn, it passes 20 of 20 under -race -cpu 1.

🤖 Generated with Claude Code

…test

Each worker keeps the lock until all four have acquired it. A worker that
the scheduler started more than HoldTurn (250ms) after the first waits for
the holders to drain, so under load or -race the workers waited on each
other until their 1s limit. The test now keeps the turn open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit ad20d38 into main Nov 13, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant