activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [activemq-artemis] branch master updated: ARTEMIS-2439 ServerSessionImpl leaks addr names
Date Fri, 02 Aug 2019 17:27:13 GMT
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a68288  ARTEMIS-2439 ServerSessionImpl leaks addr names
     new 8d7831a  This closes #2780
3a68288 is described below

commit 3a68288db65b65a49f2aad3cc866f77c59a256ed
Author: Justin Bertram <jbertram@apache.org>
AuthorDate: Mon Jul 29 11:49:35 2019 -0500

    ARTEMIS-2439 ServerSessionImpl leaks addr names
---
 .../artemis/core/server/impl/ServerSessionImpl.java   |  6 +++++-
 .../jms/client/TemporaryDestinationTest.java          | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
index bcedd1f..c442e71 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
@@ -1039,6 +1039,10 @@ public class ServerSessionImpl implements ServerSession, FailureListener
{
 
          remotingConnection.removeFailureListener(cleaner);
       }
+
+      if (server.getAddressInfo(unPrefixedQueueName) == null) {
+         targetAddressInfos.remove(queueToDelete);
+      }
    }
 
    @Override
@@ -1876,7 +1880,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener
{
       connectionFailed(me, failedOver);
    }
 
-   private Map<SimpleString, Pair<Object, AtomicLong>> cloneTargetAddresses()
{
+   public Map<SimpleString, Pair<Object, AtomicLong>> cloneTargetAddresses()
{
       return new HashMap<>(targetAddressInfos);
    }
 
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java
index c4fe54f..260b1f5 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java
@@ -228,6 +228,25 @@ public class TemporaryDestinationTest extends JMSTestBase {
    }
 
    @Test
+   public void testForTempQueueTargetInfosLeak() throws Exception {
+      try {
+         conn = createConnection();
+         Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         TemporaryQueue temporaryQueue = s.createTemporaryQueue();
+         MessageProducer producer = s.createProducer(temporaryQueue);
+         producer.send(s.createMessage());
+         temporaryQueue.delete();
+         for (ServerSession serverSession : server.getSessions()) {
+            assertFalse(((ServerSessionImpl)serverSession).cloneTargetAddresses().containsKey(SimpleString.toSimpleString(temporaryQueue.getQueueName())));
+         }
+      } finally {
+         if (conn != null) {
+            conn.close();
+         }
+      }
+   }
+
+   @Test
    public void testForSecurityCacheLeak() throws Exception {
       server.getSecurityStore().setSecurityEnabled(true);
       ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();


Mime
View raw message