-
Notifications
You must be signed in to change notification settings - Fork 786
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
Close function runs before Completion function when writing async #778
Comments
Hello @Sparkz0629, thanks for opening the issue! From the examples you shared, it is not clear how the completion function gets invoked. Would you be able to share a bit more details? |
Facing the same issue
goroutine 237 [running]:
|
I opened #805 to resolve the issue. Let us know if you are still experiencing the problem with the fix. |
@achille-roussel . apologies for the delayed response. |
Describe the bug
When making use of the Completion function on an async write, there is a race condition between the Completion function and the Close function.
This results in us not receiving the offset information from the async write response channel reliably on small batch counts.
Kafka Version
2.8.0
To Reproduce
Creation of the kafka writer:
Creation of the completion function:
The WriteMessage function:
The for loop to loop through the responseChannel and get the earliest offset for each partition:
The creation of the response channel:
The KafkaTopicOffsetPartition struct:
Expected behavior
I would expect the close function to be blocked by the Completion function so that we are able to reliably get the offset information from the response channel;.
Additional context
This only happens on small batches ( < 20 records) and it is intermittent. The failure rate is around 50%.
The text was updated successfully, but these errors were encountered: