Skip to content

(test/fix) race condition in network bridge advisory subscription initialization in AMQ6366Test#1895

Merged
cshannon merged 1 commit intoapache:mainfrom
gurpartap3697:fix/AMQ6366Test
Apr 9, 2026
Merged

(test/fix) race condition in network bridge advisory subscription initialization in AMQ6366Test#1895
cshannon merged 1 commit intoapache:mainfrom
gurpartap3697:fix/AMQ6366Test

Conversation

@gurpartap3697
Copy link
Copy Markdown
Contributor

Description

This PR fixes a race condition in the network bridge setup that cause missed advisory messages and prevent durable demand subscriptions from being created.

waitForBridgeFormation() returned as soon as remoteBrokerName was set during collectBrokerInfos() and this occurs before startRemoteBridge() registers the advisory consumer on conBroker.

In some cases following sequence occur:

  1. waitForBridgeFormation() returns early
  2. sub1 is created
  3. Its advisory message is fired
  4. The bridge advisory consumer is not yet registered on `conBroker
  5. The advisory is missed
  6. Durable demand subscription is never created on pubBroker

The fix ensures proper synchronization by waiting until the bridge’s advisory consumer is fully registered before proceeding. Now, it wait for at least one topic-region subscription on 1conBroker1

Error

AMQ6366Test>CombinationTestSupport.runBare:113->CombinationTestSupport.runBare:107->testDuplexDurableSubRestarted:54->testNonDurableReceiveThrougRestart:109 Network durable subscription should be active on BrokerA

ref - https://github.com/apache/activemq/actions/runs/23763076486/job/69370689090

Test

Ran test locally over 50 times with 100% success rate. Previously, test was failing consistently 5 out of 50 times (10% failure rate).

@gurpartap3697 gurpartap3697 changed the title Fix race condition in network bridge advisory subscription initialization (test/fix) race condition in network bridge advisory subscription initialization in AMQ6366Test Apr 9, 2026
@cshannon cshannon self-requested a review April 9, 2026 18:23
Copy link
Copy Markdown
Contributor

@cshannon cshannon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gurpartap3697 - Thanks for the fix! I noticed this the other day on a couple of my PRs but didn't get a chance to look at it yet.

@cshannon
Copy link
Copy Markdown
Contributor

cshannon commented Apr 9, 2026

I'll let the GH actions run before merging just in case

@cshannon cshannon merged commit ee5e30a into apache:main Apr 9, 2026
10 checks passed
@gurpartap3697 gurpartap3697 deleted the fix/AMQ6366Test branch April 10, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants