TaiJuWu commented on code in PR #20758:
URL: https://github.com/apache/kafka/pull/20758#discussion_r2469861779


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumerImpl.java:
##########
@@ -609,6 +609,15 @@ public synchronized ConsumerRecords<K, V> poll(final 
Duration timeout) {
             throw e.cause();
         } finally {
             kafkaShareConsumerMetrics.recordPollEnd(timer.currentTimeMs());
+
+            // Handle any acknowledgements which completed while we were 
waiting, but do not throw
+            // the exception because the fetched records would then not be 
returned to the caller
+            try {
+                handleCompletedAcknowledgements(false);
+            } catch (Throwable t) {
+                log.warn("Exception thrown in acknowledgement commit 
callback", t);
+            }

Review Comment:
   
   I find this change make `testShareGroupMaxSizeConfigExceeded` become flaky.
   The following code will fix this issue but seem to violate the comments.
   
   ```
   // Handle any acknowledgements which completed while we were waiting, but do 
not throw
   // the exception because the fetched records would then not be returned to 
the caller
   try {
       handleCompletedAcknowledgements(false);
   } catch (GroupMaxSizeReachedException e) {
       log.warn("Exception thrown in acknowledgement commit callback", e);
       throw e;
   } catch (Throwable t) {
       log.warn("Exception thrown in acknowledgement commit callback", t);
   }
   ```



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