poorbarcode opened a new pull request, #17883: URL: https://github.com/apache/pulsar/pull/17883
Fixes: - #17665 ### Motivation this test is executed as follows: 1. set max connection limited 4 2. create two clients and two producers, this will create 4 connections 3. try to create another client and producer, this will fail cause of reaches the max connections count limit But the execution logic of `step-3` is like this: 1. increment `DefaultConnectionController.totalConnectionNum` 2. if the state `State.REACH_MAX_CONNECTION_PER_IP` founded, do close connection which will decrement `DefaultConnectionController.totalConnectionNum` Then the problem is that the connection closes was executed asynchronously(see code below), if the main thread executes fast enough, the assert `Assert.assertEquals(ConnectionController.DefaultConnectionController.getTotalConnectionNum(), 4)` will fail, because the last connection has not close finish. https://github.com/apache/pulsar/blob/bde5ac7fa0ec438430b5fb1912a74bcef0d73445/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java#L153-L165 ### Modifications Change the assertion logic to executed using `Awaitility` ### Documentation - [x] `doc-not-needed` ### Matching PR in forked repository PR in forked repository: - https://github.com/poorbarcode/pulsar/pull/17 -- 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]
