This is an automated email from the ASF dual-hosted git repository. ableegoldman pushed a commit to branch 3.5 in repository https://gitbox.apache.org/repos/asf/kafka.git
commit ea206a3d36770d94289f6e6e6113c50c267791ae 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 1f2a91d27b7..c2ae9ba142a 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();
