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

kgo: fix race condition in ProduceSync #920

Closed
wants to merge 1 commit into from

Conversation

daedric
Copy link

@daedric daedric commented Mar 3, 2025

While reading the code I stumbled upon a potential race condition.
Here is my suggestion for a fix.

ProduceSync promise can be called from several goroutine at the same
time making the append() unsafe.
@daedric daedric force-pushed the ts/fix/race-sync-produce branch from 0d1c9f6 to 018d89b Compare March 3, 2025 16:27
@twmb
Copy link
Owner

twmb commented Mar 3, 2025

Luckily not a race; Produce finishes all promises in order in a dedicated goroutine

recBroadcast := cl.finishRecordPromise(pr, b.err, b.beforeBuf)

@daedric
Copy link
Author

daedric commented Mar 4, 2025

Oh thanks, that was subtle :)

@daedric daedric closed this Mar 4, 2025
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