Skip to content

fix(count): fix Acquire/Reset data race in Tracker (PIPE-1231) - #270

Open
Dylan-M wants to merge 1 commit into
dylanmyers/pipe-1222-data-race-exponentialbackofffrom
dylanmyers/pipe-1231-count-tracker-race
Open

fix(count): fix Acquire/Reset data race in Tracker (PIPE-1231)#270
Dylan-M wants to merge 1 commit into
dylanmyers/pipe-1222-data-race-exponentialbackofffrom
dylanmyers/pipe-1231-count-tracker-race

Conversation

@Dylan-M

@Dylan-M Dylan-M commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Proposed Change

Acquire() and Reset() can run at the same time, and both touch the tracker's done/resume channels. Reset() reassigns them under t.mu, but Acquire() closed the done channel without taking t.mu, so the two race.

Acquire() now takes t.mu for that close. It does this only on the final permit, so normal acquires stay lock-free.

How to validate
  • Automated: go test -race ./generator/count/ passes, including TestReset_ConcurrentWithAcquire (the failing signal before this change). Acquire and Reset are at 100% coverage.
  • Manual: run a generator with a finite count (e.g. count: 1000) and confirm it emits exactly that many records and stops.
Checklist
  • Changes are tested
  • CI has passed

…re/Reset data race (PIPE-1231)

Assisted-by: Claude Opus 4.8
@Dylan-M
Dylan-M requested review from a team as code owners August 3, 2026 13:10

Dylan-M commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Dylan-M Dylan-M changed the title fix(count): guard Tracker.Acquire terminal close with mu to fix Acquire/Reset data race (PIPE-1231) fix(count): fix Acquire/Reset data race in Tracker (PIPE-1231) Aug 3, 2026
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