chickenchickenlove opened a new pull request, #21354:
URL: https://github.com/apache/kafka/pull/21354

   ### Summary
   
   Fix flakiness in `DynamicConnectionQuotaTest#testDynamicConnectionQuota` by 
waiting until the broker’s `max.connections.per.ip.overrides` is actually 
applied in `ConnectionQuotas` before running the second verification.
   
   ### Background
   
   `testDynamicConnectionQuota` dynamically updates 
`max.connections.per.ip.overrides` from 5 to 7 and immediately starts 
`verifyMaxConnections(7, ...)`.
   
   In practice, the config update is propagated asynchronously: the broker 
`SocketServer` reconfigure is triggered, but there is a short window where the 
data-plane acceptor still evaluates new connections using the old override 
state(i.e, 5). This can cause one of the “prefill” sockets in the second 
verification to be rejected under `max=5`, breaking the test’s assumptions and 
leading to intermittent failures.
   
   ### Changes
   - Add a test-only accessor in `ConnectionQuotas` to check whether an 
override for a given IP is present.
   - In `DynamicConnectionQuotaTest`, after altering 
`max.connections.per.ip.overrides`, wait until the broker’s `ConnectionQuotas` 
observes 127.0.0.1 -> 7 before executing the second `verifyMaxConnections(...)`.
   
   ### Reproduction / Verification
   - Before: intermittent failures observed in `testDynamicConnectionQuota` 
when the override was not yet applied during the second verification.
   - After: repeated runs show the second verification consistently sees max=7 
and the test becomes deterministic.
   
   
   <img width="1568" height="730" alt="fail-1" 
src="https://github.com/user-attachments/assets/e41d9a56-7140-49ee-89c9-c4b076b9fbf2";
 />
   
   
   


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