Skip to content

Commit

Permalink
KAFKA-15429: catch+log errors from unsubscribe in streamthread shutdo…
Browse files Browse the repository at this point in the history
…wn (#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 <ableegoldman@apache.org>
  • Loading branch information
rodesai authored and ableegoldman committed Sep 3, 2023
1 parent 8eb9105 commit ac4bdb2
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -1196,8 +1196,12 @@ private void completeShutdown(final boolean cleanRun) {
} 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();
Expand Down

0 comments on commit ac4bdb2

Please sign in to comment.