Skip to content

kafka: fix data race on msgChan in connectExplicitTopics#4286

Open
mmatczuk wants to merge 1 commit intomainfrom
mmt/kafka-fix-data-race-on-msgchan-in-connectexplicittopics
Open

kafka: fix data race on msgChan in connectExplicitTopics#4286
mmatczuk wants to merge 1 commit intomainfrom
mmt/kafka-fix-data-race-on-msgchan-in-connectexplicittopics

Conversation

@mmatczuk
Copy link
Copy Markdown
Contributor

Partition consumer goroutines were spawned before k.msgChan was assigned,
causing a data race between the goroutine reads (line 104) and the
subsequent write (line 304). Move the assignment before the spawn loop.

Fixes CON-407

Partition consumer goroutines were spawned before k.msgChan was assigned,
causing a data race between the goroutine reads (line 104) and the
subsequent write (line 304). Move the assignment before the spawn loop.

Fixes CON-407
@claude
Copy link
Copy Markdown

claude bot commented Apr 16, 2026

Commits
LGTM

Review
Small, focused fix for a data race in connectExplicitTopics. The assignment k.msgChan = msgChan was happening after partition consumer goroutines were spawned, but those goroutines read k.msgChan immediately. Moving the assignment before the spawn loop eliminates the race.

LGTM

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