activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Kuhtz (JIRA)" <j...@apache.org>
Subject [jira] Created: (AMQ-1810) Patch for stop connection in case of PooledConnection and broker not available (deadlock)
Date Thu, 19 Jun 2008 13:53:00 GMT
Patch for stop connection in case of PooledConnection and broker not available (deadlock)
-----------------------------------------------------------------------------------------

                 Key: AMQ-1810
                 URL: https://issues.apache.org/activemq/browse/AMQ-1810
             Project: ActiveMQ
          Issue Type: Bug
    Affects Versions: 5.1.0
         Environment: JDK6, WinXP
            Reporter: Andreas Kuhtz
             Fix For: 5.2.0
         Attachments: amq-1810.patch

If a client tries to connect to the broker and the broker is not available the client can't
be stopped because of a deadlock in ActiveMQConnection.

The problem is that the thread that wants to establish the connection is stuck in {{syncSendPacket()}}
which is called from inside {{ensureConnectionInfoSent()}} which is {{synchronized}} (and
holds the lock on the ActiveMQConnection instance). The call to {{close()}} calls {{stop()}}
and this will call {{checkClosedOrFailed()}} which is {{synchronized}}, too, and there is
the deadlock.

The patch has removed the {{synchronized}} on the {{ensureConnectionInfoSent()}} and uses
a mutex instead to prevent calling the method unsynchronized.

Another problem is that {{PooledConnectionFactory}} is triggered from Spring classes to create
connections even if the PooledConnectionFactory was stopped (call to {{stop()}} and the new
created connections can not be stopped normally later. 
I have added a {{stopped}} flag that prevents the creation of new connecions after {{stop()}}
was called.

I think the issue AMQ-1470 is related to the same problem. 
The patch also contains the patch for AMQ-1791.

-- 
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