Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
5.6.0, 5.7.0
Description
n a broker network like this: A <-> B <--> C
Scenario:
A producer to BrokerA creates a message, sets its replyTo header to a temp destination that it creates and listens on, then sends the message off to broker A. The message is demand forwarded to BrokerC because there is a consumer there that consumes the message and replies to the temp dest in the replyTo header.
As the number of concurrent producers on BrokerA sending these messages increases, the subscription to the temp destination that was demand forwarded will not be cleaned up properly on BrokerC. The reason for this is the DemandForwardingBridge runs the remove consumer code in a separate thread. But if a "remove destination" advisory messages comes in, it will remove the destination from the AdvisoryBroker's destination map. So if this happens before the code for removeConsumer runs (in AdvisoryBroker), then the destination will not be in the destination map and the advisory for removeConsumer will not fire.
The net result is a subscription leak in the network bridge on B & C
The junit test shows two issues:
1) the subscriptions leaked when concurrent producers using request/reply and correctly closing the consumer and connection
2) all subscriptions leaked when using a single producer with request/reply and closing only the connection, and not the consumer explicitly
Issue 2 is related to temp destinations only and is compounded by
https://issues.apache.org/jira/browse/AMQ-3879