You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cs...@apache.org on 2022/02/23 12:41:55 UTC

[activemq] branch main updated (bed86a0 -> df354fa)

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

cshannon pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git.


    from bed86a0  Merge pull request #770 from mattrpav/AMQ-8493
     new d1e9ba6  AMQ-8509: Fix TempUsage memory leak
     new fb7ae90  Merge branch 'AMQ-8509' into main
     new df354fa  AMQ-8509: Update TempStore Usage test to verify cleanup

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/activemq/broker/region/Queue.java   |  3 +++
 .../java/org/apache/activemq/bugs/AMQ7085Test.java | 22 +++++++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

[activemq] 02/03: Merge branch 'AMQ-8509' into main

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cshannon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git

commit fb7ae908efea46b9c9ff12ad3727d20a9374ebae
Merge: bed86a0 d1e9ba6
Author: Christopher L. Shannon (cshannon) <ch...@gmail.com>
AuthorDate: Wed Feb 23 07:39:20 2022 -0500

    Merge branch 'AMQ-8509' into main
    
    This closes #778

 .../src/main/java/org/apache/activemq/broker/region/Queue.java         | 3 +++
 1 file changed, 3 insertions(+)

[activemq] 03/03: AMQ-8509: Update TempStore Usage test to verify cleanup

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cshannon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git

commit df354fa0237dba309592277e3cfecbe1d55690be
Author: Christopher L. Shannon (cshannon) <ch...@gmail.com>
AuthorDate: Wed Feb 23 07:40:11 2022 -0500

    AMQ-8509: Update TempStore Usage test to verify cleanup
    
    Add a unit test to the previous tests added in AMQ-7085 to verify
    TempUsage is cleaned up and stopped on Queue.stop()
---
 .../java/org/apache/activemq/bugs/AMQ7085Test.java | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/activemq-broker/src/test/java/org/apache/activemq/bugs/AMQ7085Test.java b/activemq-broker/src/test/java/org/apache/activemq/bugs/AMQ7085Test.java
index d8e2516..e818b27 100644
--- a/activemq-broker/src/test/java/org/apache/activemq/bugs/AMQ7085Test.java
+++ b/activemq-broker/src/test/java/org/apache/activemq/bugs/AMQ7085Test.java
@@ -16,6 +16,15 @@
  */
 package org.apache.activemq.bugs;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.management.ObjectName;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.jmx.BrokerView;
@@ -25,11 +34,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import javax.jms.*;
-import javax.management.ObjectName;
-
-import static org.junit.Assert.assertEquals;
-
 /**
  * Tests to ensure when the temp usage limit is updated on the broker the queues also have their
  * temp usage limits automatically updated.
@@ -94,6 +98,10 @@ public class AMQ7085Test
         brokerView.setTempLimit(newBrokerTempLimit);
         assertEquals(brokerView.getTempLimit(), newBrokerTempLimit);
         assertEquals(queueViewMBean.getTempUsageLimit(), queueTempLimit);
+
+        //Verify that TempUsage is cleaned up on Queue stop
+        brokerService.getDestination(queue).stop();
+        assertFalse(brokerService.getDestination(queue).getTempUsage().isStarted());
     }
 
     @Test
@@ -112,5 +120,9 @@ public class AMQ7085Test
         brokerView.setTempLimit(newBrokerTempLimit);
         assertEquals(brokerView.getTempLimit(), newBrokerTempLimit);
         assertEquals(queueViewMBean.getTempUsageLimit(), newBrokerTempLimit);
+
+        //Verify that TempUsage is cleaned up on Queue stop
+        brokerService.getDestination(queue).stop();
+        assertFalse(brokerService.getDestination(queue).getTempUsage().isStarted());
     }
 }

[activemq] 01/03: AMQ-8509: Fix TempUsage memory leak

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cshannon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git

commit d1e9ba68b3cbea3e9294cf4993d005c3c8ea86f2
Author: Artur Pedroso <ar...@feedzai.com>
AuthorDate: Tue Feb 22 22:10:50 2022 +0000

    AMQ-8509: Fix TempUsage memory leak
    
    If you have an application that creates lots of queues it will eventually
    fail with OOM because TempUsage is started on Queue#start but never stopped.
    
    The `systemUsage.getTempUsage().start()` used on the Queue#start
    adds elements on a List from TempUsage parent and these elements
    are never removed.
    
    To reproduce this issue you need to leave an application
    running for a long time creating different queues.
    
    The only way to avoid the leak right now is to stop the BrokerService,
    which isn't a solution.
---
 .../src/main/java/org/apache/activemq/broker/region/Queue.java         | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
index 9e01609..20f8a3a 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
@@ -1064,6 +1064,9 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index
             if (systemUsage.getStoreUsage() != null) {
                 systemUsage.getStoreUsage().stop();
             }
+            if (this.systemUsage.getTempUsage() != null) {
+                this.systemUsage.getTempUsage().stop();
+            }
             if (store != null) {
                 store.stop();
             }