You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "chia7712 (via GitHub)" <gi...@apache.org> on 2025/05/10 15:59:23 UTC
Re: [PR] KAFKA-19206: ConsumerNetworkThread.cleanup() throws NullPointerException if initializeResources() previously failed [kafka]
chia7712 commented on code in PR #19569:
URL: https://github.com/apache/kafka/pull/19569#discussion_r2083227021
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThread.java:
##########
@@ -339,11 +339,20 @@ void cleanup() {
log.trace("Closing the consumer network thread");
Timer timer = time.timer(closeTimeout);
try {
- runAtClose(requestManagers.entries(), networkClientDelegate, time.milliseconds());
+ // If an error was thrown from initializeResources(), it's possible that the list of request managers
+ // is null, so check before using. If the request manager list is null, there wasn't any real work
+ // performed, so not being able to close the request managers isn't so bad.
+ if (requestManagers != null)
+ runAtClose(requestManagers.entries(), networkClientDelegate, time.milliseconds());
Review Comment:
Should we add null check for `networkClientDelegate` too?
--
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