You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Andreas Kuhtz (JIRA)" <ji...@apache.org> on 2008/06/19 15:53:00 UTC

[jira] Created: (AMQ-1810) Patch for stop connection in case of PooledConnection and broker not available (deadlock)

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.


[jira] Resolved: (AMQ-1810) Patch for stop connection in case of PooledConnection and broker not available (deadlock)

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

Rob Davies resolved AMQ-1810.
-----------------------------

    Resolution: Fixed

Fixed applied in revision 669510, 669511 and 669512

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


[jira] Updated: (AMQ-1810) Patch for stop connection in case of PooledConnection and broker not available (deadlock)

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

Andreas Kuhtz updated AMQ-1810:
-------------------------------

    Attachment: amq-1810.patch

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