[ 
https://issues.apache.org/jira/browse/ARTEMIS-2007?focusedWorklogId=617608&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-617608
 ]

ASF GitHub Bot logged work on ARTEMIS-2007:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Jul/21 13:31
            Start Date: 01/Jul/21 13:31
    Worklog Time Spent: 10m 
      Work Description: gemmellr commented on a change in pull request #3635:
URL: https://github.com/apache/activemq-artemis/pull/3635#discussion_r662275581



##########
File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
##########
@@ -3055,6 +3058,10 @@ private boolean deliver() {
                } else if (status == HandleStatus.NO_MATCH) {
                   // nothing to be done on this case, the iterators will just 
jump next
                   consumers.reset();
+                  numNoMatch++;
+                  if (numNoMatch == consumerCount) {

Review comment:
       The JIRA and code seem like it would be trying for 'no consumers matched 
message', but since the consumers iterator is reset just before this, aren't 
many/most of the attempts leading to this count incrementing going to be 
performed against the same consumer(s, but mostly first one), rather than 
checking all the consumers?

##########
File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
##########
@@ -3066,7 +3073,7 @@ private boolean deliver() {
             } else if (!consumers.hasNext()) {
                // Round robin'd all
 
-               if (noDelivery == this.consumers.size()) {
+               if (noDelivery == consumerCount) {

Review comment:
       This seems like a potentially significant change in behaviour. I wonder 
about its safety a bit.
   
   The previous version would see any updates to the consumer list size that 
happened while this method was running, whereas the new version takes a 
snapshot of the count before starting the loop and retains it for the rest of 
the time. It retrieves the value outside the synchronized block which the loop 
goes in and out of as it operates. So it feels like it could be wrong to begin 
with, and then not reflect changes which the iterator itself can get (from e.g. 
the various resets it does), and which it does so while under synchronization.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 617608)
    Time Spent: 40m  (was: 0.5h)

> Messages not redistributed to consumers with matching filters when local non 
> matching consumers are present
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-2007
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2007
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>          Components: AMQP, Broker
>    Affects Versions: 2.6.3
>            Reporter: Sebastian T
>            Assignee: Gary Tully
>            Priority: Major
>         Attachments: AMQ2007Test.java, artemis-2007.zip
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> We are experiencing the following issue:
> # We configure an Artemis cluster with ON_DEMAND message loadbalacing and 
> message redistribution enabled.
> # We then connect a single consumer to *queues.queue1* on node1 that has a 
> message filter that does NOT match a given message.
> # Then we send a message to *queues.queue1* on node1.
> # Then we connect a consumer to *queues.queue1* on node2 that has a filter 
> matching the message we sent.
> We now would expect that the message on node1 currently not having any 
> matching consumers on node1 to be forwarded or redistributed to node2 where a 
> matching consumer exists.
> However that is not happening the consumer on node2 does not receive the 
> message and in our case the message on node1 expires after some time despite 
> a matching consumer is connected to the cluster.
> In the described scenario when we disconnect the consumer on node1 (that does 
> not match the message anyway) the message is redistributed to node2 and 
> consumed by the matching consumer.
> If no consumer was connected to node1, a message is sent to node1 and only 
> then a matching consumer is connected to node2 the message is forwarded to 
> node2 as expected.
> So I guess the core problem is that message redistribution of messages on 
> node1 is not triggered when a matching consumer is connected to node2 while a 
> *any* consumer already exists on node1 no matter if it actually matches the 
> given message.
> I attached a maven test case that illustrates the issue.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to