Skip to content

broker: fix data race from leaked goroutine in fragment store health test#481

Merged
jgraettinger merged 1 commit into
masterfrom
johnny/fix-fragment-store-health-race
Jun 3, 2026
Merged

broker: fix data race from leaked goroutine in fragment store health test#481
jgraettinger merged 1 commit into
masterfrom
johnny/fix-fragment-store-health-race

Conversation

@jgraettinger

Copy link
Copy Markdown
Contributor

TestFragmentStoreHealthCases created a broker via newTestBroker but never called cleanup(), so its resolver watch goroutine outlived the test. When a subsequent test called SetSharedPersister, the leaked goroutine was still reading the sharedPersister global in newReplica, tripping the race detector under go test -race.

Add the missing defer broker.cleanup() to tear down the broker's tasks.Group at end of test, matching every other broker test.

…test

TestFragmentStoreHealthCases created a broker via newTestBroker but never
called cleanup(), so its resolver watch goroutine outlived the test. When
a subsequent test called SetSharedPersister, the leaked goroutine was
still reading the sharedPersister global in newReplica, tripping the race
detector under `go test -race`.

Add the missing `defer broker.cleanup()` to tear down the broker's
tasks.Group at end of test, matching every other broker test.

@williamhbaker williamhbaker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jgraettinger jgraettinger merged commit 745d0e0 into master Jun 3, 2026
1 check passed
@jgraettinger jgraettinger deleted the johnny/fix-fragment-store-health-race branch June 3, 2026 19:07
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.

2 participants