This is an automated email from the ASF dual-hosted git repository. orudyy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git
The following commit(s) were added to refs/heads/master by this push: new ea2c157 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 ea2c157 is described below commit ea2c1574f40561bd782b258bdf67aec61ad5986a Author: Alex Rudyy <oru...@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 --- .../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-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org