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

ASF GitHub Bot logged work on AMQ-9852:
---------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Jan/26 13:32
            Start Date: 30/Jan/26 13:32
    Worklog Time Spent: 10m 
      Work Description: cshannon commented on PR #1641:
URL: https://github.com/apache/activemq/pull/1641#issuecomment-3823774532

   I looked at the test and I think I know what is going on but still would 
need to do some more work to prove it.
   
   The test sends the consumer info for the second consumer (consumer on real 
topic) to generate the advisory, and then immediately sends the consumer info 
for the first consumer (consumer on the advisory topic) so it can receive the 
advisory and get a replay. I believe the issue is that the advisory consumer 
may receive a duplicate of the consumer coming because it is getting both the 
"live" advisory and also a "replay" of the advisories because the second 
consumer is still in flight and being processed as coming online at the same 
time the advisor consumer is coming online. I'm not quite sure of the order but 
it seems like that is what is going on where it's just getting 2 copies as the 
logic for processing the new advisory consumer hasn't quite finished.
   
   When I run the test in a loop in Intellij it usually fails after a few 
thousand times. If I put in a 10 millisecond sleep immediately after 
[this](https://github.com/apache/activemq/blob/main/activemq-unit-tests/src/test/java/org/apache/activemq/broker/advisory/AdvisoryBrokerTest.java#L155)
 line to give the real consumer time to fully come online (which is the goal, 
so we can test replay) before bringing the advisory consumer online then the 
test no longer fails.
   
   I'm not sure there's much to do here to fix it other than fix the test, it 
would be hard to prevent issues in all cases without deadlocks. A duplicate 
consumer advisory isn't really a big deal as the consumer id is the same so the 
advisory just gets notified twice but it's the same id so I would expect 
processes listening to the advisories (like network bridges) to be able to 
handle it without issue.




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

    Worklog Id:     (was: 1002674)
    Time Spent: 20m  (was: 10m)

> AdvisoryBrokerTest: Ensure advisory firing occurs within lock to maintain 
> proper ordering
> -----------------------------------------------------------------------------------------
>
>                 Key: AMQ-9852
>                 URL: https://issues.apache.org/jira/browse/AMQ-9852
>             Project: ActiveMQ
>          Issue Type: Test
>            Reporter: Jean-Louis Monteiro
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> This popped up with 
>  
> 2026-01-27T14:10:54.4229847Z [ERROR]   
> AdvisoryBrokerTest>CombinationTestSupport.runBare:107->testConsumerAdvisoriesReplayed:175
>  ClassCast class org.apache.activemq.command.ConsumerInfo cannot be cast to 
> class org.apache.activemq.command.RemoveInfo 
> (org.apache.activemq.command.ConsumerInfo and 
> org.apache.activemq.command.RemoveInfo are in unnamed module of loader 'app')



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to