You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "vvcephei (via GitHub)" <gi...@apache.org> on 2023/04/11 15:48:31 UTC

[GitHub] [kafka] vvcephei commented on a diff in pull request #13534: KAFKA-14054: Handle TimeoutException gracefully

vvcephei commented on code in PR #13534:
URL: https://github.com/apache/kafka/pull/13534#discussion_r1163018118


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java:
##########
@@ -1195,13 +1195,8 @@ public boolean commitNeeded() {
                         commitNeeded = true;
                         entry.setValue(offset - 1);
                     }
-                } catch (final TimeoutException error) {
-                    // the `consumer.position()` call should never block, because we know that we did process data
-                    // for the requested partition and thus the consumer should have a valid local position
-                    // that it can return immediately
-
-                    // hence, a `TimeoutException` indicates a bug and thus we rethrow it as fatal `IllegalStateException`
-                    throw new IllegalStateException(error);
+                } catch (final TimeoutException swallow) {
+                    log.debug("Could not get consumer position for partition {} due to: {}", partition, swallow);

Review Comment:
   This won't print the exception. It's using https://www.javadoc.io/static/org.slf4j/slf4j-api/1.7.30/org/slf4j/Logger.html#debug-java.lang.String-java.lang.Object-java.lang.Object- , but the intent is probably to use https://www.javadoc.io/static/org.slf4j/slf4j-api/1.7.30/org/slf4j/Logger.html#debug-java.lang.String-java.lang.Throwable- , which requires a fully constructed string as the first arg.
   
   ```suggestion
                       log.debug(String.format("Could not get consumer position for partition %d", partition), swallow);
   ```



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org