vvcephei commented on a change in pull request #11111: URL: https://github.com/apache/kafka/pull/11111#discussion_r675220503
########## File path: clients/src/main/java/org/apache/kafka/clients/NetworkClientUtils.java ########## @@ -60,17 +60,16 @@ public static boolean awaitReady(KafkaClient client, Node node, Time time, long throw new IllegalArgumentException("Timeout needs to be greater than 0"); } long startTime = time.milliseconds(); - long expiryTime = startTime + timeoutMs; if (isReady(client, node, startTime) || client.ready(node, startTime)) return true; long attemptStartTime = time.milliseconds(); - while (!client.isReady(node, attemptStartTime) && attemptStartTime < expiryTime) { + while (!client.isReady(node, attemptStartTime) && attemptStartTime - startTime < timeoutMs) { if (client.connectionFailed(node)) { throw new IOException("Connection to " + node + " failed."); } - long pollTimeout = expiryTime - attemptStartTime; + long pollTimeout = (startTime - attemptStartTime) + timeoutMs; Review comment: This would still overflow if `timeoutMs` is `MAX_VALUE`, right? -- 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