Skip to content
This repository was archived by the owner on Mar 24, 2021. It is now read-only.

Conversation

yungchin
Copy link
Contributor

Because stop() called _wait_all() after stopping the OwnedBroker threads
(and because the OwnedBroker threads stop as soon as they see
self.running=False, without trying to check for remaining messages), a
situation could occur where the OwnedBroker threads had already exited
but a message was still sitting in the queue - resulting in _wait_all()
and thus stop() looping forever. We ended up with occasional hangs in
test_producer.test_async_produce_context.

This is a minimal fix, that just swaps those steps.

Signed-off-by: Yung-Chin Oei yungchin@yungchin.nl

Because stop() called _wait_all() after stopping the OwnedBroker threads
(and because the OwnedBroker threads stop as soon as they see
 self.running=False, without trying to check for remaining messages), a
situation could occur where the OwnedBroker threads had already exited
but a message was still sitting in the queue - resulting in _wait_all()
and thus stop() looping forever.  We ended up with occasional hangs in
test_producer.test_async_produce_context.

This is a minimal fix, that just swaps those steps.

Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
@yungchin
Copy link
Contributor Author

Just ran into this while starting work on producer futures, but now noticed it also happened on travis: https://travis-ci.org/Parsely/pykafka/jobs/81100168

I think this is fairly trivial so will merge right away.

yungchin added a commit that referenced this pull request Sep 19, 2015
…ssages

producer: avoid messages stuck in queues on stop
@yungchin yungchin merged commit 99bda65 into master Sep 19, 2015
@yungchin yungchin deleted the bugfix/producer-context-stuck-messages branch September 19, 2015 14:57
@emmettbutler
Copy link
Contributor

Looks fine, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants