You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Aaron Riekenberg (JIRA)" <ji...@apache.org> on 2010/02/14 17:19:33 UTC

[jira] Created: (CAMEL-2469) Stopping camel context with ActiveMQComponent does not close connections to ActiveMQ

Stopping camel context with ActiveMQComponent does not close connections to ActiveMQ
------------------------------------------------------------------------------------

                 Key: CAMEL-2469
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2469
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-activemq
    Affects Versions: 2.1.0
         Environment: Ubuntu Linux 9.10, Sun JDK 1.6.0_15, Camel 2.1.0-psc-01-00RC1, ActiveMQ 5.3.0-psc-01-00RC1
            Reporter: Aaron Riekenberg
         Attachments: ActiveMQTest.java

Stopping a camel context that uses an ActiveMQComponent does not appear to close connections to the ActiveMQBroker.  See the attached test case as an example.  It creates a camel context containing an ActiveMQ consumer and producer, sends a message, then destroys the context.  The test case does this in a loop so every 4 seconds the old camel context is destroyed and a new one is created.  Every second the test outputs the number of connections to the ActiveMQ broker.  This number continually grows over time.  After running for a few minutes I see output like this:


10:17:28,885 INFO  ActiveMQTest - num connections = 159
10:17:29,885 INFO  ActiveMQTest - num connections = 159
10:17:30,574 INFO  ActiveMQTest - creating context and sending message
10:17:30,574 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) is starting
10:17:30,574 INFO  DefaultCamelContext - JMX enabled. Using DefaultManagedLifecycleStrategy.
10:17:30,744 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) started
10:17:30,753 INFO  ActiveMQTest - consume message = message
10:17:30,885 INFO  ActiveMQTest - num connections = 160
10:17:31,885 INFO  ActiveMQTest - num connections = 160
10:17:32,747 INFO  ActiveMQTest - destroying context
10:17:32,747 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) is stopping
10:17:32,755 INFO  DefaultInflightRepository - Shutting down with no inflight exchanges.
10:17:32,755 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) stopped
10:17:32,886 INFO  ActiveMQTest - num connections = 160
10:17:33,885 INFO  ActiveMQTest - num connections = 160


Also if I do "netstat -an | grep 61616" I see the number of connections to the broker on TCP port 61616 is continually growing.

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


[jira] Updated: (CAMEL-2469) Stopping camel context with ActiveMQComponent does not close connections to ActiveMQ

Posted by "Aaron Riekenberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2469?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aaron Riekenberg updated CAMEL-2469:
------------------------------------

    Attachment: ActiveMQTest.java

Example test case

> Stopping camel context with ActiveMQComponent does not close connections to ActiveMQ
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2469
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2469
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-activemq
>    Affects Versions: 2.1.0
>         Environment: Ubuntu Linux 9.10, Sun JDK 1.6.0_15, Camel 2.1.0-psc-01-00RC1, ActiveMQ 5.3.0-psc-01-00RC1
>            Reporter: Aaron Riekenberg
>         Attachments: ActiveMQTest.java
>
>
> Stopping a camel context that uses an ActiveMQComponent does not appear to close connections to the ActiveMQBroker.  See the attached test case as an example.  It creates a camel context containing an ActiveMQ consumer and producer, sends a message, then destroys the context.  The test case does this in a loop so every 4 seconds the old camel context is destroyed and a new one is created.  Every second the test outputs the number of connections to the ActiveMQ broker.  This number continually grows over time.  After running for a few minutes I see output like this:
> 10:17:28,885 INFO  ActiveMQTest - num connections = 159
> 10:17:29,885 INFO  ActiveMQTest - num connections = 159
> 10:17:30,574 INFO  ActiveMQTest - creating context and sending message
> 10:17:30,574 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) is starting
> 10:17:30,574 INFO  DefaultCamelContext - JMX enabled. Using DefaultManagedLifecycleStrategy.
> 10:17:30,744 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) started
> 10:17:30,753 INFO  ActiveMQTest - consume message = message
> 10:17:30,885 INFO  ActiveMQTest - num connections = 160
> 10:17:31,885 INFO  ActiveMQTest - num connections = 160
> 10:17:32,747 INFO  ActiveMQTest - destroying context
> 10:17:32,747 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) is stopping
> 10:17:32,755 INFO  DefaultInflightRepository - Shutting down with no inflight exchanges.
> 10:17:32,755 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) stopped
> 10:17:32,886 INFO  ActiveMQTest - num connections = 160
> 10:17:33,885 INFO  ActiveMQTest - num connections = 160
> Also if I do "netstat -an | grep 61616" I see the number of connections to the broker on TCP port 61616 is continually growing.

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


[jira] Commented: (CAMEL-2469) Stopping camel context with ActiveMQComponent does not close connections to ActiveMQ

Posted by "Aaron Riekenberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57574#action_57574 ] 

Aaron Riekenberg commented on CAMEL-2469:
-----------------------------------------

Looking into the code, it looks like by default org.apache.activemq.camel.component.ActiveMQConfiguration.usePooledConnection = true, so ActiveMQConfiguration.createConnectionFactory creates an org.apache.activemq.pool.PooledConnectionFactory.  PooledConnectionFactory needs to have stop() called on it to close underlying connections.  Nothing in camel is doing this when the context is closed.

One possible workaround is to manually create a PooledConnectionFactory and pass it to ActiveMQComponent.setConnectionFactory.  Then you have to call stop() yourself on the PooledConnectionFactory to close connections when the camel context is stopped.

This seems to be a bad default.  If by default camel is going to create a PooledConnectionFactory for the user, shouldn't it clean it up when the context is closed?

> Stopping camel context with ActiveMQComponent does not close connections to ActiveMQ
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2469
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2469
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-activemq
>    Affects Versions: 2.1.0
>         Environment: Ubuntu Linux 9.10, Sun JDK 1.6.0_15, Camel 2.1.0-psc-01-00RC1, ActiveMQ 5.3.0-psc-01-00RC1
>            Reporter: Aaron Riekenberg
>         Attachments: ActiveMQTest.java
>
>
> Stopping a camel context that uses an ActiveMQComponent does not appear to close connections to the ActiveMQBroker.  See the attached test case as an example.  It creates a camel context containing an ActiveMQ consumer and producer, sends a message, then destroys the context.  The test case does this in a loop so every 4 seconds the old camel context is destroyed and a new one is created.  Every second the test outputs the number of connections to the ActiveMQ broker.  This number continually grows over time.  After running for a few minutes I see output like this:
> 10:17:28,885 INFO  ActiveMQTest - num connections = 159
> 10:17:29,885 INFO  ActiveMQTest - num connections = 159
> 10:17:30,574 INFO  ActiveMQTest - creating context and sending message
> 10:17:30,574 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) is starting
> 10:17:30,574 INFO  DefaultCamelContext - JMX enabled. Using DefaultManagedLifecycleStrategy.
> 10:17:30,744 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) started
> 10:17:30,753 INFO  ActiveMQTest - consume message = message
> 10:17:30,885 INFO  ActiveMQTest - num connections = 160
> 10:17:31,885 INFO  ActiveMQTest - num connections = 160
> 10:17:32,747 INFO  ActiveMQTest - destroying context
> 10:17:32,747 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) is stopping
> 10:17:32,755 INFO  DefaultInflightRepository - Shutting down with no inflight exchanges.
> 10:17:32,755 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) stopped
> 10:17:32,886 INFO  ActiveMQTest - num connections = 160
> 10:17:33,885 INFO  ActiveMQTest - num connections = 160
> Also if I do "netstat -an | grep 61616" I see the number of connections to the broker on TCP port 61616 is continually growing.

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


[jira] Commented: (CAMEL-2469) Stopping camel context with ActiveMQComponent does not close connections to ActiveMQ

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57578#action_57578 ] 

Claus Ibsen commented on CAMEL-2469:
------------------------------------

Aaron good findings.

You could probably try to see if you can patch the AMQ component to be able to stop the connection factory when its stopped.


> Stopping camel context with ActiveMQComponent does not close connections to ActiveMQ
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2469
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2469
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-activemq
>    Affects Versions: 2.1.0
>         Environment: Ubuntu Linux 9.10, Sun JDK 1.6.0_15, Camel 2.1.0-psc-01-00RC1, ActiveMQ 5.3.0-psc-01-00RC1
>            Reporter: Aaron Riekenberg
>         Attachments: ActiveMQTest.java
>
>
> Stopping a camel context that uses an ActiveMQComponent does not appear to close connections to the ActiveMQBroker.  See the attached test case as an example.  It creates a camel context containing an ActiveMQ consumer and producer, sends a message, then destroys the context.  The test case does this in a loop so every 4 seconds the old camel context is destroyed and a new one is created.  Every second the test outputs the number of connections to the ActiveMQ broker.  This number continually grows over time.  After running for a few minutes I see output like this:
> 10:17:28,885 INFO  ActiveMQTest - num connections = 159
> 10:17:29,885 INFO  ActiveMQTest - num connections = 159
> 10:17:30,574 INFO  ActiveMQTest - creating context and sending message
> 10:17:30,574 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) is starting
> 10:17:30,574 INFO  DefaultCamelContext - JMX enabled. Using DefaultManagedLifecycleStrategy.
> 10:17:30,744 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) started
> 10:17:30,753 INFO  ActiveMQTest - consume message = message
> 10:17:30,885 INFO  ActiveMQTest - num connections = 160
> 10:17:31,885 INFO  ActiveMQTest - num connections = 160
> 10:17:32,747 INFO  ActiveMQTest - destroying context
> 10:17:32,747 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) is stopping
> 10:17:32,755 INFO  DefaultInflightRepository - Shutting down with no inflight exchanges.
> 10:17:32,755 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) stopped
> 10:17:32,886 INFO  ActiveMQTest - num connections = 160
> 10:17:33,885 INFO  ActiveMQTest - num connections = 160
> Also if I do "netstat -an | grep 61616" I see the number of connections to the broker on TCP port 61616 is continually growing.

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


[jira] Updated: (CAMEL-2469) Stopping camel context with ActiveMQComponent does not close connections to ActiveMQ

Posted by "Aaron Riekenberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2469?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aaron Riekenberg updated CAMEL-2469:
------------------------------------

    Attachment: camel2469.patch

Here is a patch against activemq trunk.

This fixes my test case and passes all unit tests for activemq-camel.

> Stopping camel context with ActiveMQComponent does not close connections to ActiveMQ
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2469
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2469
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-activemq
>    Affects Versions: 2.1.0
>         Environment: Ubuntu Linux 9.10, Sun JDK 1.6.0_15, Camel 2.1.0-psc-01-00RC1, ActiveMQ 5.3.0-psc-01-00RC1
>            Reporter: Aaron Riekenberg
>         Attachments: ActiveMQTest.java, camel2469.patch
>
>
> Stopping a camel context that uses an ActiveMQComponent does not appear to close connections to the ActiveMQBroker.  See the attached test case as an example.  It creates a camel context containing an ActiveMQ consumer and producer, sends a message, then destroys the context.  The test case does this in a loop so every 4 seconds the old camel context is destroyed and a new one is created.  Every second the test outputs the number of connections to the ActiveMQ broker.  This number continually grows over time.  After running for a few minutes I see output like this:
> 10:17:28,885 INFO  ActiveMQTest - num connections = 159
> 10:17:29,885 INFO  ActiveMQTest - num connections = 159
> 10:17:30,574 INFO  ActiveMQTest - creating context and sending message
> 10:17:30,574 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) is starting
> 10:17:30,574 INFO  DefaultCamelContext - JMX enabled. Using DefaultManagedLifecycleStrategy.
> 10:17:30,744 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) started
> 10:17:30,753 INFO  ActiveMQTest - consume message = message
> 10:17:30,885 INFO  ActiveMQTest - num connections = 160
> 10:17:31,885 INFO  ActiveMQTest - num connections = 160
> 10:17:32,747 INFO  ActiveMQTest - destroying context
> 10:17:32,747 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) is stopping
> 10:17:32,755 INFO  DefaultInflightRepository - Shutting down with no inflight exchanges.
> 10:17:32,755 INFO  DefaultCamelContext - Apache Camel 2.1.0-psc-01-00RC1 (CamelContext:camel-160) stopped
> 10:17:32,886 INFO  ActiveMQTest - num connections = 160
> 10:17:33,885 INFO  ActiveMQTest - num connections = 160
> Also if I do "netstat -an | grep 61616" I see the number of connections to the broker on TCP port 61616 is continually growing.

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