merlimat commented on a change in pull request #1755: Configure Netty allocator in bookie and client URL: https://github.com/apache/bookkeeper/pull/1755#discussion_r228687050
########## File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java ########## @@ -634,6 +639,21 @@ public Bookie(ServerConfiguration conf, StatsLogger statsLogger) this.indexDirsManager = createIndexDirsManager(conf, diskChecker, statsLogger.scope(LD_INDEX_SCOPE), this.ledgerDirsManager); + this.allocator = ByteBufAllocatorBuilder.create() + .poolingPolicy(conf.getAllocatorPoolingPolicy()) + .poolingConcurrency(conf.getAllocatorPoolingConcurrency()) + .outOfMemoryPolicy(conf.getAllocatorOutOfMemoryPolicy()) + .outOfMemoryListener((ex) -> { + try { + LOG.error("Unable to allocate memory, exiting bookie", ex); + shutdown(-1); + } finally { + Runtime.getRuntime().halt(-1); Review comment: How should be pass it? What I wanted to achieve here is: * Try to shutdown bookie gracefully (mainly to close ZK session such that new ledgers won't choose this bookie) * No matter what, bring the process down after that attempt. This would protect from a thread hanging on in background to keep JVM alive. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services