dajac commented on code in PR #17411: URL: https://github.com/apache/kafka/pull/17411#discussion_r1796501961
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java: ########## @@ -1277,10 +1278,13 @@ private void releaseAssignmentAndLeaveGroup(final Timer timer) { UnsubscribeEvent unsubscribeEvent = new UnsubscribeEvent(calculateDeadlineMs(timer)); applicationEventHandler.add(unsubscribeEvent); try { - // If users subscribe to an invalid topic name, they will get InvalidTopicException in error events, - // because network thread keeps trying to send MetadataRequest in the background. - // Ignore it to avoid unsubscribe failed. - processBackgroundEvents(unsubscribeEvent.future(), timer, e -> e instanceof InvalidTopicException); + // Network thread keeps trying to send MetadataRequest in the background. + // If there is invalid request, there will have many error events. We would like to ignore it to avoid unsubscribe fail. + // Ignore exceptions: + // InvalidTopicException: avoid invalid topic name. + // UnsupportedVersionException: avoid sending consumer group protocol to unsupported broker. + processBackgroundEvents(unsubscribeEvent.future(), timer, + e -> e instanceof InvalidTopicException || e instanceof UnsupportedVersionException); Review Comment: I don't fully understand why we need this too. -- 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