[
https://issues.apache.org/jira/browse/ARTEMIS-2531?focusedWorklogId=334275&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-334275
]
ASF GitHub Bot logged work on ARTEMIS-2531:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 25/Oct/19 18:20
Start Date: 25/Oct/19 18:20
Worklog Time Spent: 10m
Work Description: jbertram commented on pull request #2872: ARTEMIS-2531:
Fix filter in FederatedQueue to prevent infinite consumer creation in a
circular or bidrectional setup
URL: https://github.com/apache/activemq-artemis/pull/2872#discussion_r339180495
##########
File path:
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedQueueTest.java
##########
@@ -177,6 +177,11 @@ public void testFederatedQueueBiDirectional() throws
Exception {
producer1.send(session1.createTextMessage("hello"));
assertNotNull(consumer0.receive(1000));
+ //Sleep to see if extra consumers are created - this tests to make
sure there is no loop and tests the FederatedQueue metaDataFilterString
+ //is working properly - should only be 1 consumer on each (1 for the
local consumer on broker0 and 1 for the federated consumer on broker1)
+ Thread.sleep(1000);
+ assertEquals(1, ((QueueBinding)
getServer(0).getPostOffice().getBinding(SimpleString.toSimpleString(queueName))).consumerCount());
+ assertEquals(1, ((QueueBinding)
getServer(1).getPostOffice().getBinding(SimpleString.toSimpleString(queueName))).consumerCount());
Review comment:
One thought here...Instead of using `Thread.sleep(1000)` you could do
something like this:
```
assertFalse(Wait.waitFor(() ->
getServer(0).locateQueue(SimpleString.toSimpleString(queueName)).getConsumerCount()
> 1, 500, 100));
assertFalse(Wait.waitFor(() ->
getServer(1).locateQueue(SimpleString.toSimpleString(queueName)).getConsumerCount()
> 1, 500, 100));
```
I used 500 on both calls because you were originally sleeping for 1000ms and
1000/2=500. The advantage here (albeit small) is that the test would fail
faster. Also, using `locateQueue()` is a bit more elegant than
`getPostOffice().getBinding()`.
I don't feel strongly about the change. Just thought I'd throw it out there.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 334275)
Time Spent: 20m (was: 10m)
> FederatedQueue has invalid filter string leading to an infinite consumer loop
> -----------------------------------------------------------------------------
>
> Key: ARTEMIS-2531
> URL: https://issues.apache.org/jira/browse/ARTEMIS-2531
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: Broker
> Affects Versions: 2.10.1
> Reporter: Christopher L. Shannon
> Assignee: Christopher L. Shannon
> Priority: Major
> Fix For: 2.11.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> FederatedQueue by default is supposed to set a metadataFilter to will exclude
> reacting to federated consumers so a loop isn't created. Unfortunately the
> filter does not work because there is a hyphen in the name so it gets
> ignored. The property needs to be prefixed with "hyphenated_props:" for the
> filter to work. Currently an infinite loop and consumers will be rapidly
> created until crashing the broker unless the filter is fixed (if using by
> directional federated queues)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)