chenyulin0719 opened a new pull request, #18506: URL: https://github.com/apache/kafka/pull/18506
It's related to KAFKA-18298 and KAFKA-18297. To prevent members from rejoining after being removed, stop poll() in ConsumerThread before removing group members. This PR fixed below flaky errors with ClassicConsumer tests: 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)) 2. **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)) **Note**: This PR only fixed the flaky with ClassicConsumer. To fix the same error in AsyncConsumer, there should be another to prevent consumer's heartbeat before group members beigng removed. **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