chenyulin0719 opened a new pull request, #18513: URL: https://github.com/apache/kafka/pull/18513
It's related to KAFKA-18298 and KAFKA-18297. To prevent members from rejoining after being removed, close consumers in ConsumerThread before removing group members. The members deletion flow has been changed to 1. Before member deletion: 2 static, 1 dynamic member in group 2. After closed consumers: 2 static member in group 3. After remove 1 static member:1 static member in group 4. After remove remain member in group: group is empty This PR fixed below flaky errors: 1. **PlaintextAdminIntegrationTest#testConsumerGroups** a. `org.opentest4j.AssertionFailedError: expected: <2> but was: <3>` ([Report](https://ge.apache.org/s/lt3lpviv45cns/tests/task/:core:test/details/kafka.api.PlaintextAdminIntegrationTest/testConsumerGroups(String%2C%20String)%5B1%5D?top-execution=1)) b. `org.opentest4j.AssertionFailedError: expected: <true> but was: <false>` ([Report](https://ge.apache.org/s/jlxo446xalpoa/tests/task/:core:test/details/kafka.api.PlaintextAdminIntegrationTest/testConsumerGroups(String%2C%20String)%5B1%5D?top-execution=1)) 5. **PlaintextAdminIntegrationTest#testConsumerGroupsDeprecatedConsumerGroupState** a. `org.opentest4j.AssertionFailedError: expected: <2> but was: <3>` ([Report](https://ge.apache.org/s/ndoj6s2stb446/tests/task/:core:test/details/kafka.api.PlaintextAdminIntegrationTest/testConsumerGroupsDeprecatedConsumerGroupState(String%2C%20String)%5B1%5D?top-execution=1)) b. `org.opentest4j.AssertionFailedError: expected: <true> but was: <false>` ([Report](https://ge.apache.org/s/kh3jze2tc5qeu/tests/task/:core:test/details/kafka.api.PlaintextAdminIntegrationTest/testConsumerGroupsDeprecatedConsumerGroupState(String%2C%20String)%5B1%5D?top-execution=1)) Test command: (No error within 100 loops in my local env) ``` N=100; I=0; while [ $I -lt $N ] && ./gradlew core:test --tests PlaintextAdminIntegrationTest.testConsumerGroups --tests PlaintextAdminIntegrationTest.testConsumerGroupsDeprecatedConsumerGroupState --rerun --fail-fast; do (( I=$I+1 )); echo "Completed run: $I"; sleep 1; done ``` **Note**: The flaky can be reproduced with[ this patch](https://issues.apache.org/jira/secure/attachment/13073949/0001-Reproduce-KAFKA-18298-and-KAFKA-18297-in-ClassicConsumer.patch). (Uncomment the sleep 1 sec) **Co-authored-by**: TaiJuWu (tjwu1...@gmail.com) ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org