Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
fix potential deadlock in pulsar client close #5731
A deadlock on PulsarClient.close() can happen if there are producers/consumers that are not closed prior to calling PulsarClient.close() and we have to close them in the routine. The deadlock happens be cause we piggy pack off of a "pulsar-io" thread that is used to shutdown the connection in producer/consumer close, to also shutdown the EventLoopGroup. "pulsar-io" thread is part of the EventLoopGroup thus it tries to shutdown itself and causes a deadlock.
Below is a stacktrace of what it look like:
This deadlock went unnoticed for a long time because in the past we never waited for the shutdown of the EventLoopGroup to complete
Also #5628 does not solve the issue. This PR should supersede that one.