This is an automated email from the ASF dual-hosted git repository.

chenhang pushed a commit to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit 1ed33f207dc12fa81f680c9eda212f8e9c3d0f4e
Author: Lari Hotari <[email protected]>
AuthorDate: Mon Aug 23 21:15:51 2021 +0300

    [Broker] Call .release() when discarding entry to prevent direct memory 
leak (#11748)
    
    (cherry picked from commit 7906bb5990a918adfc47ed0ab52063caabac2801)
---
 .../service/persistent/PersistentDispatcherSingleActiveConsumer.java    | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java
index 4bae5b0..c4bea81 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java
@@ -175,7 +175,9 @@ public class PersistentDispatcherSingleActiveConsumer 
extends AbstractDispatcher
                 Entry entry = iterator.next();
                 byte[] key = peekStickyKey(entry.getDataBuffer());
                 Consumer consumer = stickyKeyConsumerSelector.select(key);
+                // Skip the entry if it's not for current active consumer.
                 if (consumer == null || currentConsumer != consumer) {
+                    entry.release();
                     iterator.remove();
                 }
             }

Reply via email to