You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Luke Chen (Jira)" <ji...@apache.org> on 2026/06/29 06:44:00 UTC

[jira] [Created] (KAFKA-20746) NPE in MetadataCache#toCluster

Luke Chen created KAFKA-20746:
---------------------------------

             Summary: NPE in MetadataCache#toCluster
                 Key: KAFKA-20746
                 URL: https://issues.apache.org/jira/browse/KAFKA-20746
             Project: Kafka
          Issue Type: Bug
    Affects Versions: 4.3.1, 4.2.0
            Reporter: Luke Chen


In KAFKA-18225, we fix a bug to allow `ClientQuotaCallback#updateClusterMetadata` to be supported in KRaft mode. But the cluster object generated in MetadataCache could cause NPE. See [https://github.com/strimzi/kafka-quotas-plugin/issues/71] for more info.

 

I think the root cause is that in toCluster method, we filter out the fenced brokers to build brokerToNodes map [here|https://github.com/apache/kafka/blob/4.3.1/metadata/src/main/java/org/apache/kafka/metadata/MetadataCache.java#L151-L154]. But later, we want to get all the replicas info, which include the fenced replicas, via the filtered brokerToNodes map. So it causes the NPE. That's my assumption because from the original reported bug, we don't have other info. But it's a possible way to cause NPE. We should also think if there is other possibility to cause NPE here. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)