This is an automated email from the ASF dual-hosted git repository. ableegoldman pushed a commit to branch 3.6 in repository https://gitbox.apache.org/repos/asf/kafka.git
commit ac4bdb2111c424fd8c409f4d2004d9083115a355 Author: Rohan <[email protected]> AuthorDate: Sat Sep 2 18:13:16 2023 -0700 KAFKA-15429: catch+log errors from unsubscribe in streamthread shutdown (#14325) Preliminary fix for KAFKA-15429 which updates StreamThread.completeShutdown to catch-and-log errors from consumer.unsubscribe. Though this does not prevent the exception, it does preserve the original exception that caused the stream thread to exit. Reviewers: Anna Sophie Blee-Goldman <[email protected]> --- .../apache/kafka/streams/processor/internals/StreamThread.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java b/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java index 883ec25ff10..8d5fe3d5a0a 100644 --- a/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java +++ b/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java @@ -1196,8 +1196,12 @@ public class StreamThread extends Thread { } catch (final Throwable e) { log.error("Failed to close changelog reader due to the following error:", e); } - if (leaveGroupRequested.get()) { - mainConsumer.unsubscribe(); + try { + if (leaveGroupRequested.get()) { + mainConsumer.unsubscribe(); + } + } catch (final Throwable e) { + log.error("Failed to unsubscribe due to the following error: ", e); } try { mainConsumer.close();
