Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: data race in roundrobin balancer #1251

Merged
merged 1 commit into from
Dec 13, 2023
Merged

Conversation

petedannemann
Copy link
Contributor

@petedannemann petedannemann commented Dec 12, 2023

#1232 introduced a data race in the roundrobin balancer. It isn't a meaningful one, but still shows up when you use kafka-go as a library and run go test -race

@petedannemann petedannemann marked this pull request as ready for review December 12, 2023 21:50
@LKaemmerling
Copy link

We encountered this issue as well, would be great to get this merged soonish :)

@4ND3R50N
Copy link

I´m experiencing the same issue, our tests are failing when checking with -race

@LKaemmerling
Copy link

LKaemmerling commented Dec 13, 2023

Quickfix (without this MR, but this MR is preferred):

- Set the Balancer to RoundRobin explicitly and set ChunkSize to at least 1
w := &kafka.Writer{
	Addr:     kafka.TCP("localhost:9092", "localhost:9093", "localhost:9094"),
	Topic:   "topic-A",
	Balancer: &kafka.RoundRobin{
			ChunkSize: 1,
		},
}

@petedannemann petedannemann merged commit 2af3101 into main Dec 13, 2023
14 checks passed
@petedannemann petedannemann deleted the fix/roundrobin-race branch December 13, 2023 14:30
@petedannemann
Copy link
Contributor Author

Fixed in https://github.com/segmentio/kafka-go/releases/tag/v0.4.47

@4ND3R50N
Copy link

That was fast! thank u guys!

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.

None yet

4 participants