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:43:43 UTC

[activemq] branch activemq-5.16.x updated (e84025c -> 8674538)

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

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


    from e84025c  AMQ-8488: make the build fail quickly and obviously if not run on Java 8, which is required.
     new 84a28d7  AMQ-8509: Fix TempUsage memory leak
     new 8674538  AMQ-8509: Update TempStore Usage test to verify cleanup

The 2 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/02: 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 activemq-5.16.x
in repository https://gitbox.apache.org/repos/asf/activemq.git

commit 8674538d617d61f55fe5ef0c80f5f74e75115b77
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()
    
    (cherry picked from commit df354fa0237dba309592277e3cfecbe1d55690be)
---
 .../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/02: 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 activemq-5.16.x
in repository https://gitbox.apache.org/repos/asf/activemq.git

commit 84a28d78f27541b3c9790b3d8d9430566954378b
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.
    
    (cherry picked from commit d1e9ba68b3cbea3e9294cf4993d005c3c8ea86f2)
---
 .../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 13e952b..448e844 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();
             }