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-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to