lizhimins opened a new issue, #11007:
URL: https://github.com/apache/rocketmq/issues/11007

   ### Before Creating the Bug Report
   
   - [X] I found a bug, not just asking a question.
   - [X] I have searched the GitHub Issues and Discussions of this repository 
and believe that this is not a duplicate.
   - [X] I have confirmed that this bug belongs to the current repository.
   
   ### Runtime platform environment
   
   OS: Ubuntu 22.04 (GitHub Actions runner `ubuntu-latest`)
   
   ### RocketMQ version
   
   branch: develop
   version: 5.x
   Git commit id: latest develop
   
   ### JDK Version
   
   Compiler: JDK 8 (maven-compile job, ubuntu-latest)
   
   ### Describe the Bug
   
   `CreateAndUpdateTopicIT` intermittently fails in the CI integration test 
pipeline. The assertions on topic route size run immediately after topic 
creation / broker registration, but route propagation from broker to NameServer 
is asynchronous. Under CI load, the NameServer route table may not have been 
fully updated when the assertion executes, causing a race condition.
   
   Observed failure on an unrelated PR (apache/rocketmq#11001), CI run 
33726673235:
   
   ```
   CreateAndUpdateTopicIT.java#L142
   Expected size: 3 but was: 2 in:
   [BrokerData [brokerName=TestBrokerName_2, brokerAddrs={0=127.0.0.1:35821}, 
enableActingMaster=false],
    BrokerData [brokerName=TestBrokerName_1, brokerAddrs={0=127.0.0.1:33565}, 
enableActingMaster=false]]
   ```
   
   The failing test `testCreateOrUpdateTopic_EnableSplitRegistration` calls 
`registerBrokerAll(...)` on all 3 brokers and then immediately asserts 
`route.getBrokerDatas()).hasSize(3)`. One broker's registration had not yet 
propagated to the NameServer when the assertion ran.
   
   ### Steps to Reproduce
   
   1. Run the integration test `CreateAndUpdateTopicIT` in the CI pipeline (or 
repeatedly under load).
   2. The route-size assertions (`hasSize(3)`) in 
`testCreateOrUpdateTopic_EnableSplitRegistration`, 
`testCreateOrUpdateTopic_EnableSingleTopicRegistration`, and 
`testStaticTopicNotAffected` execute without waiting for route propagation.
   3. Occasionally the assertion observes only 2 BrokerData entries instead of 
3.
   
   Note: `testDeleteTopicFromNameSrvWithBrokerRegistration` in the same class 
is already `@Ignore`d with the comment "Temporarily ignore the fact that this 
test cannot pass in the integration test pipeline due to unknown reasons", 
indicating this class has known flakiness.
   
   ### What Did You Expect to See?
   
   The tests should wait for the route to propagate before asserting, and pass 
deterministically.
   
   ### What Did You See Instead?
   
   Intermittent failure: `Expected size: 3 but was: 2`.
   
   ### Additional Context
   
   The fix is to wrap the route-size assertions in `awaitility` polling 
(`await().atMost(30, TimeUnit.SECONDS).untilAsserted(...)`), consistent with 
the existing pattern already used in 
`testDeleteTopicFromNameSrvWithBrokerRegistration`.
   


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

Reply via email to