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


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManager.java:
##########
@@ -188,18 +188,18 @@ public HeartbeatRequestManager(
     @Override
     public NetworkClientDelegate.PollResult poll(long currentTimeMs) {
         if (!coordinatorRequestManager.coordinator().isPresent() ||
-            membershipManager.shouldSkipHeartbeat() ||
-            pollTimer.isExpired()) {
+            membershipManager.shouldSkipHeartbeat()) {
             membershipManager.onHeartbeatRequestSkipped();
             return NetworkClientDelegate.PollResult.EMPTY;
         }
         pollTimer.update(currentTimeMs);
-        if (pollTimer.isExpired()) {
-            logger.warn("consumer poll timeout has expired. This means the 
time between subsequent calls to poll() " +
-                "was longer than the configured max.poll.interval.ms, which 
typically implies that " +
-                "the poll loop is spending too much time processing messages. 
You can address this " +
-                "either by increasing max.poll.interval.ms or by reducing the 
maximum size of batches " +
-                "returned in poll() with max.poll.records.");
+        if (pollTimer.isExpired() && !membershipManager.isLeavingGroup()) {
+            logger.warn("Consumer poll timeout has expired. This means the 
time between " +
+                "subsequent calls to poll() was longer than the configured 
max.poll.interval.ms, " +
+                "which typically implies that the poll loop is spending too 
much time processing " +
+                "messages. You can address this either by increasing 
max.poll.interval.ms or by " +
+                "reducing the maximum size of batches returned in poll() with 
max.poll.records.");
+

Review Comment:
   We want both conditions together, because we do want to continue down to ln 
212 if the timer expired and the member is leaving, basically letting the 
ongoing leaving operation win over the expired poll. That would be one of these 
cases:
   - timer expired and member is in PREPARE_LEAVING: we do want to continue 
sending HB while preparing to leave, until the callback completes and then 
transition to LEAVING. 
   - timer expired and member is in LEAVING : we do want to send that last HB 
that the LEAVING sends, and then transition out of the LEAVING to UNSUBSCRIBED



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