Skip to content

fix: data race in roundrobin balancer - #1251

Merged
petedannemann merged 1 commit into
mainfrom
fix/roundrobin-race
Dec 13, 2023
Merged

fix: data race in roundrobin balancer#1251
petedannemann merged 1 commit into
mainfrom
fix/roundrobin-race

Conversation

@petedannemann

@petedannemann petedannemann commented Dec 12, 2023

Copy link
Copy Markdown
Contributor

#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
Copy Markdown

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

@4ND3R50N

Copy link
Copy Markdown

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

@LKaemmerling

LKaemmerling commented Dec 13, 2023

Copy link
Copy Markdown

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
@petedannemann
petedannemann deleted the fix/roundrobin-race branch December 13, 2023 14:30
@petedannemann

Copy link
Copy Markdown
Contributor Author

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

@4ND3R50N

Copy link
Copy Markdown

That was fast! thank u guys!

ashishkf pushed a commit to kloudfuse/kafka-go that referenced this pull request Aug 4, 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.

4 participants