activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "TH L. (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (AMQ-2716) ActiveMQConnection leaks memory by caching ActiveMQTempQueue objects
Date Thu, 29 Apr 2010 13:23:34 GMT

    [ https://issues.apache.org/activemq/browse/AMQ-2716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59160#action_59160
] 

TH L. edited comment on AMQ-2716 at 4/29/10 9:23 AM:
-----------------------------------------------------

{quote}
target <---------------------------- sender 
 \
  \/
temp reply queue ---------------> receiver
{quote}

should I close the resource in fllowing order?
{quote}
 receiver.close();        	
 replyQueue.delete(); 
 sender.close(); 
 session.close(); 
 connection.close(); 
{quote}

does AMQ not follow the javax.jms.Connection definition?
Even in the javadoc from ActiveMQConnection#close there is the same description...
{quote}
Closing a connection causes all temporary destinations to be deleted.
{quote}
But it seems that we must delete temp queue explicitly


btw, I still cannot figure out the NPE ....




      was (Author: easyl):
    does AMQ not follow the javax.jms.Connection definition?
{quote}
http://java.sun.com/javaee/6/docs/api/javax/jms/Connection.html#close()
There is no need to close the sessions, producers, and consumers of a closed connection.
Closing a connection causes all temporary destinations to be deleted.
{quote}


  
> ActiveMQConnection leaks memory by caching ActiveMQTempQueue objects
> --------------------------------------------------------------------
>
>                 Key: AMQ-2716
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2716
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, Geronimo Integration, JMS client, Transport
>    Affects Versions: 5.3.0
>         Environment: 64bit, SuSE 11, Sun Java 1.6.0_17, Geronimo 2.2, embedded AMQ 5.3,
TCP Tranport
>            Reporter: TH L.
>
> After running messaging several hours with more than 2,000,000 asynchronous send and
more than1,000,000 synchronous send/reply (with temp Queue), I found about 1.5G ActiveMQConnection
objects in my whole 2G memory heap (inspected with jmap and Eclipse Memory Analyzer).
> The 1.5G ActiveMQConnection objects and their referencing objects stay in heap old generation
and cannot be cleaned by GC.
> By looking into those ActiveMQConnections, I found there are a huge amount of HashMaps
holding temp Queue information (e.g. ActiveMQTempQueue with different sequenceId, physicalName,
etc.)
> Since the ActiveMQConnections are pooled, however, why those ActiveMQTempQueues are always
kept in ActiveMQConnections?
> is that a bug? or did I do something wrong (wrong setup, wrong client code)?
> My client code
> {{{
>         QueueConnection connection = null;
>         QueueSession session = null;
>         Queue requestQueue = null;
>         Queue replyQueue = null;
>         QueueReceiver receiver = null;
>         QueueSender sender = null;
>         try {
>             connection = aConnFactory.createQueueConnection();
>             connection.start();
>             session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
>             requestQueue = getDestinationQueue();
>             sender = session.createSender(requestQueue);
>             replyQueue = session.createTemporaryQueue(); // using temp queue
>             aRequestMessage.setJMSReplyTo(replyQueue);
>             sender.send(aRequestMessage, DeliveryMode.NON_PERSISTENT, Message.DEFAULT_PRIORITY,
timeToLive);
>             receiver = session.createReceiver(replyQueue);
>             receiver.receive();
>         } catch (Exception e) {
>               ...
>         } finally {
>             try { receiver.close(); } catch (Exception ignored) {}
>             try { sender.close(); } catch (Exception ignored) {}
>             try { session.close(); } catch (Exception ignored) {}
>             try { connection.close(); } catch (Exception ignored) {}            
>         }
> }}}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message