You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/09/26 11:53:19 UTC

[GitHub] [pulsar] Shoothzj opened a new pull request #12200: Allow to config pulsar client allocator out of memory policy

Shoothzj opened a new pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200


   ### Motivation
   When the client jvm direct memory is full, we don't want pulsar client to use heap memory which may lead to a Heap OutOfMemoryError. In this scene, we want the client allocate memory failure until the direct memory is free enough.
   
   ### Modifications
   
   Make the OutOfMemoryPolicy configurely.
   
   ### Documentation
     
   - [ ] no-need-doc 
     
     Currently, this part has no doc, I will start a new PR to add these below configs to our document.
   ![image](https://user-images.githubusercontent.com/12933197/134806609-41bea8e6-0897-4107-9f17-2e38f90e813a.png)
   
   
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on a change in pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on a change in pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#discussion_r726111634



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/allocator/PulsarByteBufAllocator.java
##########
@@ -39,6 +40,7 @@
     public static final String PULSAR_ALLOCATOR_POOLED = "pulsar.allocator.pooled";
     public static final String PULSAR_ALLOCATOR_EXIT_ON_OOM = "pulsar.allocator.exit_on_oom";
     public static final String PULSAR_ALLOCATOR_LEAK_DETECTION = "pulsar.allocator.leak_detection";
+    public static final String PULSAR_ALLOCATOR_FALL_BACK_TO_HEAP = "pulsar.allocator.fall_back_to_heap";

Review comment:
       Fixed




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-940873472


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-939391482


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-940963212


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-940712750


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-941748101


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-941861763


   @eolivelli Please help review PR again.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-952816987


   Confirmed w/ @Shoothzj, this feature is not merged in 2.8, so the doc is only added to `master`. 


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj removed a comment on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj removed a comment on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-940018342


   > Why not convert the string to enum? In this way, even if new items are added to the enum, the code here does not need to be modified
   
   I want to keep the style with former codes. And boolean variable looks like enough.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-941070911


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj removed a comment on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj removed a comment on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-940712750






-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-939238362


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-940021586


   > Why not convert the string to enum? In this way, even if new items are added to the enum, the code here does not need to be modified
   
   You are right. Enum will be better.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-952718024


   Doc is added here: https://github.com/apache/pulsar/pull/12481 


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on a change in pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on a change in pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#discussion_r731574751



##########
File path: pulsar-common/src/test/java/org/apache/pulsar/common/allocator/PulsarByteBufAllocatorOomThrowExceptionTest.java
##########
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.common.allocator;
+
+import io.netty.buffer.ByteBufAllocator;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.bookkeeper.common.allocator.LeakDetectionPolicy;
+import org.apache.bookkeeper.common.allocator.OutOfMemoryPolicy;
+import org.apache.bookkeeper.common.allocator.PoolingPolicy;
+import org.apache.bookkeeper.common.allocator.impl.ByteBufAllocatorBuilderImpl;
+import org.apache.bookkeeper.common.allocator.impl.ByteBufAllocatorImpl;
+import org.mockito.Mockito;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.testng.IObjectFactory;
+import org.testng.annotations.ObjectFactory;
+import org.testng.annotations.Test;
+
+@PrepareForTest({ByteBufAllocatorImpl.class, ByteBufAllocatorBuilderImpl.class})
+@PowerMockIgnore({"javax.management.*", "javax.ws.*", "org.apache.logging.log4j.*"})
+@Slf4j
+public class PulsarByteBufAllocatorOomThrowExceptionTest {
+
+    @ObjectFactory
+    public IObjectFactory getObjectFactory() {
+        return new org.powermock.modules.testng.PowerMockObjectFactory();
+    }
+
+    @Test
+    public void testDefaultConfig() throws Exception {
+        System.setProperty("pulsar.allocator.out_of_memory_policy", "ThrowException");

Review comment:
       I don't know it. Thank you . Fixed.




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj removed a comment on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj removed a comment on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-946545577


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-940581944


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-940018342


   > Why not convert the string to enum? In this way, even if new items are added to the enum, the code here does not need to be modified
   
   I want to keep the style with former codes. And boolean variable looks like enough.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-940922929


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-939419982


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-939196658


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj removed a comment on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj removed a comment on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-941070911






-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-946381256


   @Shoothzj double check: this PR is labeled with 2.8.2, should the doc be added to both the `2.8.2` doc set and `master`?


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-946545577


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] hangc0276 commented on a change in pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on a change in pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#discussion_r725727783



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/allocator/PulsarByteBufAllocator.java
##########
@@ -39,6 +40,7 @@
     public static final String PULSAR_ALLOCATOR_POOLED = "pulsar.allocator.pooled";
     public static final String PULSAR_ALLOCATOR_EXIT_ON_OOM = "pulsar.allocator.exit_on_oom";
     public static final String PULSAR_ALLOCATOR_LEAK_DETECTION = "pulsar.allocator.leak_detection";
+    public static final String PULSAR_ALLOCATOR_FALL_BACK_TO_HEAP = "pulsar.allocator.fall_back_to_heap";

Review comment:
       We'd better configure the property into `src/pom.xml` for pulsar tests
   ```java
   <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
           <configuration>
             <argLine> -Xmx1G -XX:+UseG1GC
               -Dpulsar.allocator.pooled=true
               -Dpulsar.allocator.leak_detection=Advanced
               -Dpulsar.allocator.exit_on_oom=false
               -Dio.netty.tryReflectionSetAccessible=true
               ${test.additional.args}
             </argLine>
             ...
   </plugin>
   ```




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-927299511


   @eolivelli, @codelipenghui, @BewareMyPower, @sijie, @hangc0276, @merlimat - PTAL, thanks.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-927329633


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-930942167


   Thanks for your contribution. Please do not forget to update docs later. And you can ping me to review the docs, thanks.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] eolivelli merged pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
eolivelli merged pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200


   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] eolivelli commented on a change in pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#discussion_r731570106



##########
File path: pulsar-common/src/test/java/org/apache/pulsar/common/allocator/PulsarByteBufAllocatorOomThrowExceptionTest.java
##########
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.common.allocator;
+
+import io.netty.buffer.ByteBufAllocator;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.bookkeeper.common.allocator.LeakDetectionPolicy;
+import org.apache.bookkeeper.common.allocator.OutOfMemoryPolicy;
+import org.apache.bookkeeper.common.allocator.PoolingPolicy;
+import org.apache.bookkeeper.common.allocator.impl.ByteBufAllocatorBuilderImpl;
+import org.apache.bookkeeper.common.allocator.impl.ByteBufAllocatorImpl;
+import org.mockito.Mockito;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.testng.IObjectFactory;
+import org.testng.annotations.ObjectFactory;
+import org.testng.annotations.Test;
+
+@PrepareForTest({ByteBufAllocatorImpl.class, ByteBufAllocatorBuilderImpl.class})
+@PowerMockIgnore({"javax.management.*", "javax.ws.*", "org.apache.logging.log4j.*"})
+@Slf4j
+public class PulsarByteBufAllocatorOomThrowExceptionTest {
+
+    @ObjectFactory
+    public IObjectFactory getObjectFactory() {
+        return new org.powermock.modules.testng.PowerMockObjectFactory();
+    }
+
+    @Test
+    public void testDefaultConfig() throws Exception {
+        System.setProperty("pulsar.allocator.out_of_memory_policy", "ThrowException");

Review comment:
       please add System.clearProperty in a finally block, otherwise we are going to pollute the test env




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-938497598


   > Thanks for your contribution. Please do not forget to update docs later. And you can ping me to review the docs, thanks.
   
   Currently, this part has no doc, I think start a new PR will be better.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-927304776


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-938497152


   @eolivelli PTAL


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-940620115


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-940830573


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-941861763


   @eolivelli Please help review PR again.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Shoothzj commented on pull request #12200: Allow to config pulsar client allocator out of memory policy

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #12200:
URL: https://github.com/apache/pulsar/pull/12200#issuecomment-941748101


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org