lhotari opened a new pull request, #21407:
URL: https://github.com/apache/pulsar/pull/21407

   ### Motivation
   
   LocalBookkeeperEnsemble leaks threads and memory.
   The way it leaks threads is when `portManager` is set to `() -> 0`, the 
metadata in Zookeeper will conflict and the bookies that start after the first 
bookie will first throw InvalidCookieException. When the InvalidCookieException 
is thrown, threads are leaked since the embedded bookie server doesn't close 
the Zookeeper client in that case.
   
   Another problem is the memory leak that happens via shutdown hooks when 
Bookkeeper's `ComponentStarter` class is used to start each bookie. That 
registers a shutdown hook which essentially causes a memory leak.
   
   ### Modifications
   
   Instead of passing port number 0 to the embedded bookie server, allocate a 
free port with `PortManager::nextLockedFreePort`.
   
    The solution to the memory leak via the shutdown hook is to start the 
component directly without the `ComponentStarter`.
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to