ivankelly commented on a change in pull request #1755:  Configure Netty 
allocator in bookie and client 
URL: https://github.com/apache/bookkeeper/pull/1755#discussion_r228458207
 
 

 ##########
 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:
   Don't call this directly here.  Bookie is used in all tests, and halt 
getting called in the middle of a test is a pain to track down (especially 
since in OOM scenario, the LOG may fail). 

----------------------------------------------------------------
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

Reply via email to