mjsax commented on a change in pull request #9368: URL: https://github.com/apache/kafka/pull/9368#discussion_r499105759
########## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/AbstractTask.java ########## @@ -137,4 +146,48 @@ public void update(final Set<TopicPartition> topicPartitions, final Map<String, this.inputPartitions = topicPartitions; topology.updateSourceTopics(nodeToSourceTopics); } + + @Override + public void maybeInitTaskTimeoutOrThrow(final long currentWallClockMs, + final TimeoutException timeoutException, + final Logger log) throws StreamsException { + if (deadlineMs == NO_DEADLINE) { + deadlineMs = currentWallClockMs + taskTimeoutMs; + } else if (currentWallClockMs > deadlineMs) { + final String errorMessage = String.format( + "Task %s did not make progress within %d ms. Adjust `%s` if needed.", + id, + currentWallClockMs - deadlineMs + taskTimeoutMs, + StreamsConfig.TASK_TIMEOUT_MS_CONFIG + ); + + if (timeoutException != null) { + throw new TimeoutException(errorMessage, timeoutException); + } else { + throw new TimeoutException(errorMessage); + } + } + + if (timeoutException != null) { + log.debug( + "Timeout exception. Remaining time to deadline {}; retrying.", + deadlineMs - currentWallClockMs, + timeoutException + ); + } else { + log.debug( + "Task did not make progress. Remaining time to deadline {}; retrying.", + deadlineMs - currentWallClockMs + ); + } + + } + + @Override + public void clearTaskTimeout(final Logger log) { + if (deadlineMs != NO_DEADLINE) { Review comment: As we call this reset logic "blindly" we put this guard to avoid spamming the logs. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org