activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anuj Khandelwal (JIRA)" <>
Subject [jira] [Commented] (AMQ-5357) Race conditions in ActiveMQ Connection Pooling
Date Thu, 25 Sep 2014 11:53:34 GMT


Anuj Khandelwal commented on AMQ-5357:

Hi Tim,

I have seen a new feature "allowLinkStealing" with ActiveMQv5.10. This is supposed to be used
with mqtt transport.
but this options seems to be working for my issue. I tested when a normal durable client is
connecting to the borker and if other client tries with the same client id, it still throws
exception saying "javax.jms.JMSException: Durable consumer is in use for client: Test and
subscriptionName: ActiveMQConsumer"

But when broker keeps stale entries of client ids and actually no client is connected, then
the new client is able to connect properly.

I just want to know that can I use it for normal tcp transport or will there be some consequence


> Race conditions in ActiveMQ Connection Pooling
> ----------------------------------------------
>                 Key: AMQ-5357
>                 URL:
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: activemq-pool, Broker
>    Affects Versions: 5.10.0
>            Reporter: Anuj Khandelwal
> Hi,
> Broker version : 5.10.0
> Problem : 
> I am using ActiveMQv5.10.0 broker in my setup. In my broker I am facing a weird problem
where a durable subscriber is not able to connect to the broker because of stale subscription
shown by the broker with the same client id. Please note that this issue is not reproducible,
I tried but not able to reproduce. It happens sometimes. 
> Details: 
> In my application I am creating 3 durable subscriptions on different topics. I am using
PooledConnectionFactory with maxConnection=3 to create connections for each listener. I am
using separate Spring Default message listener container for creation of the each listener.

> Sometime when I start my client, I get below exception :  
> -----------
> listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful():907 ERROR]:
Could not refresh JMS Connection for destination 'topic://test.newPnlSpn' - retrying in 5000
ms. Cause: Broker: mqbrokerdev - Client: new_pnl_spn_test_client already connected from tcp://a.b.c.d:2338

> -----------
> But when I check connections from "a.b.c.d". I don;t see any connections from the IP.
Even on JConsole, it does not show any clients connecting to the same topic with this client_id.

> In some cases i observed that this is the IP address where my client was previously running.

> Because of this issue my current client which is running from some other IP address is
not able to connect to the broker. 
> I suspect that there is some race condition in ActiveMQ connection pooling. This is a
serious issue I am facing in my setup, My clients are not able to connect to the broker.
> When I face this issue :
> I tried to restart the broker by clearing out the persistent store, but this issue was
still there. It only got resolved when I changed the client ID of my listener. 
> Which means broker somewhere keeping stale connection state for this client id. As soon
as new client id comes, it start working properly and connecting to the broker.
> Detailed Error logs: 
> [20140915 16:23:14:964 IST (jmsContainer-6) org.springframework.jms.listener.DefaultMessageListenerContainer#handleListenerSetupFailure
666 ERROR] - Setup
>  of JMS message listener invoker failed - trying to recover 
> javax.jms.IllegalStateException: javax.jms.InvalidClientIDException: Broker: mqbrokerdev
- Client: new_pnl_spn_seed_client already connected from tcp://10
> *.*.*.*:3456
>         at org.apache.activemq.jms.pool.ConnectionPool.createSession(
>         at org.apache.activemq.jms.pool.PooledConnection.createSession(
>         at
>         at org.springframework.jms.listener.DefaultMessageListenerContainer.access$1000(
>         at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.initResourcesIfNecessary(DefaultMessageListenerCon
>         at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.jav
> a:869)
>         at org.springframework.jms.listener.DefaultMessageListenerContainer$
>         at
> Caused by: javax.jms.InvalidClientIDException: Broker: mqbrokerdev - Client: new_pnl_spn_seed_client
already connected from tcp://
>         at
>         at
>         at
>         at
>         at
>         at
>         at
>         at
>         at tools.jms.ActiveMQLoggingPlugin.addConnection(
>         at
>         at
>         at
>         at org.apache.activemq.command.ConnectionInfo.visit(
>         at
>         at$1.onCommand(
>         at org.apache.activemq.transport.MutexTransport.onCommand(
>         at org.apache.activemq.transport.WireFormatNegotiator.onCommand(
>         at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(
>         at org.apache.activemq.transport.TransportSupport.doConsume(
>         at org.apache.activemq.transport.tcp.TcpTransport.doRun(
>         at
>         ... 1 more
> Thanks,
> Anuj

This message was sent by Atlassian JIRA

View raw message