Skip to content

fix 10s logging data race - #60

Merged
RaduBerinde merged 1 commit into
masterfrom
fix-10s-race
Oct 6, 2025
Merged

RaduBerinde merged 1 commit into
masterfrom
fix-10s-race

Conversation

@RaduBerinde

@RaduBerinde RaduBerinde commented Oct 6, 2025 •

Copy link
Copy Markdown
Member

The goroutine that logs every 10 seconds can race with the function exiting, which can lead to a data race or even a panic because of t.Log used after the test exits.

The fix is to block until the goroutine is exiting, by writing to the unbuffered channel instead of closing it.

I reproduced and verified the fix, but it required temporary code changes and the test is too slow to check in.


This change is Reviewable

The goroutine that logs every 10 seconds can race with the function
exiting, which can lead to a data race or even a panic because of
t.Log used after the test exits.

The fix is to block until the goroutine is exiting, by writing to the
unbuffered channel instead of closing it.
@RaduBerinde
RaduBerinde requested a review from kev-cao October 6, 2025 15:49

@kev-cao kev-cao left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM! Thanks for getting the fix out

@RaduBerinde

Copy link
Copy Markdown
Member Author

TFTR!

@RaduBerinde
RaduBerinde merged commit f84f9e5 into master Oct 6, 2025
12 checks passed
@RaduBerinde
RaduBerinde deleted the fix-10s-race branch October 6, 2025 15:59
craig Bot pushed a commit to cockroachdb/cockroach that referenced this pull request Oct 7, 2025
154867: go.mod: bump datadriven r=RaduBerinde a=RaduBerinde

Bump datadriven to incorporate a fix
(cockroachdb/datadriven#60).

Epic: none
Release note: None

Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
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