kirktrue commented on code in PR #15640: URL: https://github.com/apache/kafka/pull/15640#discussion_r1579735209
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java: ########## @@ -1270,6 +1230,20 @@ private void close(Duration timeout, boolean swallowException) { if (applicationEventHandler != null) closeQuietly(() -> applicationEventHandler.close(Duration.ofMillis(closeTimer.remainingMs())), "Failed shutting down network thread", firstException); closeTimer.update(); + + if (backgroundEventReaper != null && backgroundEventQueue != null) { Review Comment: They're only `null` if there was an error in the constructor. The constructor's `finally` block calls `close()`, so we need to handle the case where the consumer wasn't fully constructed before it's closed. -- 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org