ivankelly opened a new pull request #1132: Fix shutdown race which left ZK 
session open
URL: https://github.com/apache/bookkeeper/pull/1132
   There was a race when shutting down a bookie, where both the main
   thread and the shutdown hook thread would try to close the bookie
   service. This would result in them racing to set the lifecycle state
   and neither would end up cleaning up properly. Specifically, the
   starter latch would be counted down, so the main thread would start to
   close, then the shutdown hook would run, try to close, and get an
   exception when it tried to change the state. Once the all shutdown
   hooks end, the process exits, even if main hasn't completed. This
   leaves the zookeeper session open.
   The fix has 3 parts.
   1. I've removed the close from main(). The shutdown hook will
      always run on a graceful shutdown, so that's the place to do the
   2. I've removed the latch and replaced it with a CompletableFuture,
      so that errors in shutdown can be propogated to the main thread.
   3. Changes in lifecycle state are now atomic, so that only one thread
      will perform the actions for state transitions.

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

Reply via email to