You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "mattisonchao (via GitHub)" <gi...@apache.org> on 2023/07/18 05:25:10 UTC

[GitHub] [pulsar] mattisonchao commented on a diff in pull request #20823: [fix][broker] Fix direct memory leak by delayed index OutOfDirectMemory

mattisonchao commented on code in PR #20823:
URL: https://github.com/apache/pulsar/pull/20823#discussion_r1266238658


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -1065,7 +1066,17 @@ public boolean trackDelayedDelivery(long ledgerId, long entryId, MessageMetadata
             delayedDeliveryTracker.get().resetTickTime(topic.getDelayedDeliveryTickTimeMillis());
 
             long deliverAtTime = msgMetadata.hasDeliverAtTime() ? msgMetadata.getDeliverAtTime() : -1L;
-            return delayedDeliveryTracker.get().addMessage(ledgerId, entryId, deliverAtTime);
+            try {
+                return delayedDeliveryTracker.get().addMessage(ledgerId, entryId, deliverAtTime);
+            } catch (OutOfDirectMemoryError ex) {

Review Comment:
   The current implementation is the first approach, but we don't introduce a fixed value.  Instead, we use a dynamic value to do it.
   
   > Set the maximum memory usage of the delay message.
   This is hard to set a reasonable value.
   
   > stuck new read
   when we recover?
   



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -1065,7 +1066,17 @@ public boolean trackDelayedDelivery(long ledgerId, long entryId, MessageMetadata
             delayedDeliveryTracker.get().resetTickTime(topic.getDelayedDeliveryTickTimeMillis());
 
             long deliverAtTime = msgMetadata.hasDeliverAtTime() ? msgMetadata.getDeliverAtTime() : -1L;
-            return delayedDeliveryTracker.get().addMessage(ledgerId, entryId, deliverAtTime);
+            try {
+                return delayedDeliveryTracker.get().addMessage(ledgerId, entryId, deliverAtTime);
+            } catch (OutOfDirectMemoryError ex) {

Review Comment:
   The current implementation is the first approach, but we don't introduce a fixed value.  Instead, we use a dynamic value to do it.
   
   > Set the maximum memory usage of the delay message.
   
   This is hard to set a reasonable value.
   
   > stuck new read
   
   when we recover?
   



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