Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.8, 0.10, 0.12, 0.14, 0.16, 0.18, 0.20, 0.22, 0.24, 0.26, 0.28, 0.30, 0.32
-
None
Description
A client's call to Connection#close may hang awaiting failover to exhaust its retry count. This occurs because the failover thread has acquired the failover mutex, and closing sessions requires the same mutex.
If the connection has no Sessions, instead the Connection#close will complete, but the failover thread will continue to spin in the background.
The following could be done to fix the issue:
- AMQConnection#attemptReconnection while expression needs to include !isClosed().
- AMQConnection#close() needs to acquire the failover mutex after its call to doClose(sessions, timeout) to ensure that, in the case of a connection without sessions, the thread performing failover will have finished its work (i.e. for 0-8 the FailoverThread will be ending) before #close returns to the caller.
- #AMQConnection#exceptionReceived needs to lose responsibility for mutating closed/closing. This responsibility needs to be pushed to its callers. 0-10 already does this, this change will make 0-8 the same. This will mean that _closed means the user has closed the connections, or the Broker has closed the connection and failover has given up.
- Remove Closable#resetClosedFlag