C0urante commented on code in PR #12478: URL: https://github.com/apache/kafka/pull/12478#discussion_r963777991
########## connect/runtime/src/main/java/org/apache/kafka/connect/runtime/errors/RetryWithToleranceOperator.java: ########## @@ -268,8 +275,12 @@ void backoff(int attempt, long deadline) { if (delay + time.milliseconds() > deadline) { delay = deadline - time.milliseconds(); Review Comment: In `execAndRetry` we check to see if we've exceeded the deadline before backing off: https://github.com/yashmayya/kafka/blob/9c6dc1c3129f4166eede9f6287e44bf1a5a1bcf8/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/errors/RetryWithToleranceOperator.java#L183-L184 In `backoff`, we check the current time again and, if necessary, shorten our delay in order to avoid exceeding the deadline: https://github.com/yashmayya/kafka/blob/9c6dc1c3129f4166eede9f6287e44bf1a5a1bcf8/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/errors/RetryWithToleranceOperator.java#L275-L278 If we exceed the deadline after the first check in `execAndRetry` and before we shorten the delay in `backoff`, then we can end up with a negative delay right now. We could test this by calling `MockTime::sleep` before invoking `backoff`, so that when `backoff` is called, we will have exceeded the deadline. -- 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