Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 39500 invoked from network); 19 Jul 2010 22:13:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Jul 2010 22:13:17 -0000 Received: (qmail 90443 invoked by uid 500); 19 Jul 2010 22:13:17 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 90388 invoked by uid 500); 19 Jul 2010 22:13:16 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 90380 invoked by uid 99); 19 Jul 2010 22:13:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jul 2010 22:13:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jul 2010 22:13:13 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o6JMCpp8012915 for ; Mon, 19 Jul 2010 22:12:52 GMT Message-ID: <22888305.46411279577571821.JavaMail.jira@thor> Date: Mon, 19 Jul 2010 18:12:51 -0400 (EDT) From: "Eugene Rodos (JIRA)" To: dev@activemq.apache.org Subject: [jira] Updated: (AMQ-2838) Memory Leak when using ConnectionConsumer and a Persistent Broker In-Reply-To: <29414761.46401279577452294.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/AMQ-2838?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eugene Rodos updated AMQ-2838: ------------------------------ Attachment: ConnectionConsumerMemoryLeakTest.java > Memory Leak when using ConnectionConsumer and a Persistent Broker > ----------------------------------------------------------------- > > Key: AMQ-2838 > URL: https://issues.apache.org/activemq/browse/AMQ-2838 > Project: ActiveMQ > Issue Type: Bug > Components: Broker > Affects Versions: 5.3.1 > Reporter: Eugene Rodos > Attachments: ConnectionConsumerMemoryLeakTest.java > > > I found a memory leak in ActiveMQ when using an embedded broker with persistence (enabled by default) and using the connection to create a ConnectionConsumer. The memory leak occurs after performing the following steps: > 1. acquire a Connection (ActiveMQConnection) from a ConnectionFactory (ActiveMQConnectionFactory) > 2. use the Connection to create a ConnectionConsumer > 3. close the ConnectionConsumer > 4. close the Connection > 5. repeat steps 1 and 4 from above > The memory leak is in org.apache.activemq.thread.Scheduler. After the last connection is closed, the embedded broker is shutdown. When this happens all AMQ threads are killed except for the "ActiveMQ Scheduler" thread. This is a Timer that contains a queue of scheduled tasks. If no brokers are running, this queue should be empty. In fact if persistence is turned off on the broker, the queue is correctly emptied after the last connection is closed. However, with persistence on, the queue does not get emptied completely. > The memory leak is directly proportional to the number of ConnectionConsumers that are created on the connection. That is, the more ConnectionConsumers are created, the more tasks will remain on the Scheduler's task queue after the connection is closed. > In our test environment, we create many ConnectionConsumer objects for each test and run many such tests. The memory leak accumulates quickly and we soon get an OutOfMemoryException. > I'm attaching a junit test that illustrates the problem. The NUM_OF_CYCLES and NUM_OF_CONNECTION_CONSUMERS constants can be increased to see how the memory leak grows with increased number of iterations and ConnectionConsumer objects created, respectively. Also, persistence can be turned off on the broker url to see that the test succeeds in that case (i.e. no RAM leak). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.