You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2019/11/24 21:28:05 UTC

[qpid-broker-j] branch 7.1.x updated: QPID-8384: [Broker-J] Try to remove LVQ entry from the latest value map after setting the latest value reference if entry is deleted before the reference is set

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

orudyy pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git


The following commit(s) were added to refs/heads/7.1.x by this push:
     new c9a4232  QPID-8384: [Broker-J] Try to remove LVQ entry from the latest value map after setting the latest value reference if entry is deleted before the reference is set
c9a4232 is described below

commit c9a4232c1a208a3b453016cd9243710d5cf4844e
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Sat Nov 23 22:25:08 2019 +0000

    QPID-8384: [Broker-J] Try to remove LVQ entry from the latest value map after setting the latest value reference if entry is deleted before the reference is set
    
    (cherry picked from commit ea2c1574f40561bd782b258bdf67aec61ad5986a)
---
 .../org/apache/qpid/server/queue/LastValueQueueList.java    | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/broker-core/src/main/java/org/apache/qpid/server/queue/LastValueQueueList.java b/broker-core/src/main/java/org/apache/qpid/server/queue/LastValueQueueList.java
index 1fb2adb..35decc3 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/queue/LastValueQueueList.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/queue/LastValueQueueList.java
@@ -241,12 +241,21 @@ public class LastValueQueueList extends OrderedQueueEntryList
                 Object key = getMessage().getMessageHeader().getHeader(_conflationKey);
                 _latestValuesMap.remove(key,_latestValueReference);
             }
-
         }
 
-        public void setLatestValueReference(final AtomicReference<ConflationQueueEntry> latestValueReference)
+        void setLatestValueReference(final AtomicReference<ConflationQueueEntry> latestValueReference)
         {
             _latestValueReference = latestValueReference;
+
+            // When being added entry is deleted before setting #_latestValueReference (due to some unfortunate thread
+            // scheduling), the entry can be left in #_latestValuesMap and cause OOM errors due to heap consumption
+            // by deleted LVQ entries linked with leaked one.
+            // Thus, in order to avoid memory leaks, the entry (which gets deleted before #_latestValueReference is set)
+            // needs to be attempted to remove from #_latestValuesMap.
+            if (isDeleted())
+            {
+                onDelete();
+            }
         }
 
         private void discardIfReleasedEntryIsNoLongerLatest()


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org