m1a2st commented on code in PR #23227:
URL: https://github.com/apache/kafka/pull/23227#discussion_r3920511779


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java:
##########
@@ -221,7 +221,19 @@ public void signalClose() {
      */
     @Override
     public long maximumTimeToWait(long currentTimeMs) {
-        return autoCommitState.map(ac -> 
ac.remainingMs(currentTimeMs)).orElse(Long.MAX_VALUE);
+        if (autoCommitState.isEmpty()) {
+            return Long.MAX_VALUE;
+        }
+        AutoCommitState autoCommit = autoCommitState.get();
+        // An auto-commit is only sent when the coordinator is known; poll() 
returns EMPTY otherwise.
+        // If the coordinator is unavailable (e.g. bootstrap DNS resolution is 
still in progress),
+        // falling through to the timer-based remainingMs() would return 0 
once the auto-commit interval
+        // elapses, since the auto-commit timer remains permanently expired. 
This would cause both the
+        // application and network threads to busy-spin.
+        if (coordinatorRequestManager.coordinator().isEmpty()) {
+            return autoCommit.autoCommitIntervalMs();

Review Comment:
   Thanks for the feedback. I agree that we should use `retryBackoffMs` instead 
of `autoCommitIntervalMs`, and I can file a patch to address it.



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