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

How to handle a closed message channel? #474

Closed
4578395263256 opened this issue Jun 16, 2015 · 3 comments
Closed

How to handle a closed message channel? #474

4578395263256 opened this issue Jun 16, 2015 · 3 comments

Comments

@4578395263256
Copy link

When in the consume loop from a PartitionConsumer, in some cases the message channel gets closed (this usually happens when killing brokers). In this situation, would it be safe to call ConsumePartition again or do you need to wait for something? Also it looks like it should be safe to call AsyncClose, but is it necessary to do so?

@eapache
Copy link
Contributor

eapache commented Jun 16, 2015

The only time a PartitionConsumer should shut itself down is when the offset it is consuming is no longer in range. I'm not sure why this would happen when killing brokers... that seems odd.

Regardless, it should be safe to re-consume that partition, and it is probably not safe (or necessary) to call AsyncClose again

@4578395263256
Copy link
Author

Thanks for the information. FWIW our java consumers are getting OffsetOutOfRange. To clarify what we are doing, we are killing the whole cluster (first SIGTERM, then after a few min SIGKILL) and then bringing it back up after a bit, to see if problems occur.

@eapache
Copy link
Contributor

eapache commented Jun 17, 2015

FWIW our java consumers are getting OffsetOutOfRange

Then that is almost certainly what Sarama is getting as well. I'm not sure why that's happening, but that's a question for the upstream Kafka folks.

In this case you do not need to (and should not) call AsyncClose, you can simply re-consume that partition and let the old PartitionConsumer pass out of scope.

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

No branches or pull requests

2 participants