lianetm commented on code in PR #14873: URL: https://github.com/apache/kafka/pull/14873#discussion_r1414217500
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManager.java: ########## @@ -166,11 +175,23 @@ public HeartbeatRequestManager( */ @Override public NetworkClientDelegate.PollResult poll(long currentTimeMs) { - if (!coordinatorRequestManager.coordinator().isPresent() || membershipManager.shouldSkipHeartbeat()) { + if (!coordinatorRequestManager.coordinator().isPresent() || + membershipManager.shouldSkipHeartbeat() || + pollTimer.isExpired()) { 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."); + return PollResult.EMPTY; Review Comment: I'm thinking what about instead of returning the empty here, we transition the member to "leaving" (`transitionToSendingLeaveGroup`), and that's it. On the following lines that should make the shouldHbNow true, we would send the last HB and transition to unsubscribed (effectively leaving without triggering the callbacks, which is what the old logic does) -- 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