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

Fixed race condition in producer Flush() operation #229

Merged
merged 1 commit into from
Apr 20, 2020

Conversation

merlimat
Copy link
Contributor

Motivation

There is a race condition that make Producer.Flush() to get stuck.

The flush operation works by attaching itself as a callback on the last item in the pending messages queue. Once the (current) last message in the queue is published, then flush is completed.

The problem is that we check the last item in queue and then we grab a mutex and add the flush request. If the the pending item is completed before we grab the mutex, then the flush callback will never be called.

@merlimat merlimat added this to the 0.1.1 milestone Apr 20, 2020
@merlimat merlimat self-assigned this Apr 20, 2020
@merlimat merlimat merged commit fcda9b5 into apache:master Apr 20, 2020
@merlimat merlimat deleted the fix-flush branch April 20, 2020 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants