You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by lq...@apache.org on 2017/11/07 11:28:00 UTC
[2/2] qpid-broker-j git commit: QPID-7998: [Broker-J][AMQP 1.0] When
removing global shared subscription links on detach synchronize on the
VirtualHost
QPID-7998: [Broker-J][AMQP 1.0] When removing global shared subscription links on detach synchronize on the VirtualHost
This is done to avoid a race which would lead to
* a client-side 'not-found' error on unsubscribe and
* a leaked subscription queue on the broker which might accumulate messages.
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/0b991f4a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/0b991f4a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/0b991f4a
Branch: refs/heads/7.0.x
Commit: 0b991f4a9ee462fb7e721df9ebdc683f38ebd858
Parents: 3651583
Author: Lorenz Quack <lq...@apache.org>
Authored: Tue Nov 7 11:27:36 2017 +0000
Committer: Lorenz Quack <lq...@apache.org>
Committed: Tue Nov 7 11:27:36 2017 +0000
----------------------------------------------------------------------
.../qpid/server/protocol/v1_0/SendingLinkEndpoint.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0b991f4a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpoint.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpoint.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpoint.java
index 9c783b8..c4b4dd6 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpoint.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpoint.java
@@ -873,10 +873,17 @@ public class SendingLinkEndpoint extends AbstractLinkEndpoint<Source, Target>
else
{
Pattern linkNamePattern = Pattern.compile("^" + Pattern.quote(getLinkName()) + "$");
- final Collection<LinkModel> links = addressSpace.findSendingLinks(ANY_CONTAINER_ID, linkNamePattern);
- if (links.size() > 1)
+ // TODO: locking on the addressSpace is not nice! Without we have a race which could mean that the last
+ // two links from different connections detach concurrently and both get removed from the registry.
+ // If the client then tries to do a null-source lookup (for unsubscribe) the attach would be rejected
+ // with 'not-found' and the subscription queue would leak potentially accumulating messages.
+ synchronized (addressSpace)
{
- getLink().linkClosed();
+ final Collection<LinkModel> links = addressSpace.findSendingLinks(ANY_CONTAINER_ID, linkNamePattern);
+ if (links.size() > 1)
+ {
+ getLink().linkClosed();
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org