lianetm commented on code in PR #19647:
URL: https://github.com/apache/kafka/pull/19647#discussion_r2079983666


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumerImpl.java:
##########
@@ -1017,8 +1017,12 @@ private void maybeThrowInvalidGroupIdException() {
      * <p>
      * If the acknowledgement commit callback throws an exception, this method 
will throw an exception.
      */
-    private void handleCompletedAcknowledgements() {
-        processBackgroundEvents();
+    private void handleCompletedAcknowledgements(boolean onClose) {
+        // If the user gets any fatal errors, they will get these exceptions 
in the background queue.
+        // While closing, we ignore these exceptions so that the consumers 
close successfully.
+        processBackgroundEvents(onClose ? e -> (e instanceof 
GroupAuthorizationException

Review Comment:
   Sharing some context in case it helps (related to handling this for the 
consumer `unsubscribe`/`close`)
   
   In that case it made sense to ignore the `TopicAuth` and `GroupAuth` 
exceptions because those are the ones we could get in the HB to leave the group 
that we seemed to be irrelevant to the user wanting to leave already. 
   
   We only considered errors that could come in the HB response, without having 
to worry about Metadata errors (like InvalidTopic) because, for the consumer 
case, the unsubscribe operation in not aware of those (metadata errors are not 
propagated via the generic error queue for the AsyncConsumer, so they won't 
come out when `processingBackgroundEvents` on unsubscribe or close)
   
   But the ShareConsumer does get Metadata errors via the generic error queue, 
so I would expect that it makes sense to ignore the `InvalidTopic` in this case 
too (along with any other error that could come in a MetadataResponse). Maybe 
worth looking at the `handleTopicMetadata` in `KafkaApis` in case another error 
generated there seems sensible to ignore in this case (I don't see any other 
from a quick look but could be missing something)



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

Reply via email to