You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Chia-Ping Tsai (Jira)" <ji...@apache.org> on 2026/07/10 13:45:00 UTC

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

     [ https://issues.apache.org/jira/browse/KAFKA-20746?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chia-Ping Tsai resolved KAFKA-20746.
------------------------------------
    Resolution: Fixed

> NPE in MetadataCache#toCluster
> ------------------------------
>
>                 Key: KAFKA-20746
>                 URL: https://issues.apache.org/jira/browse/KAFKA-20746
>             Project: Kafka
>          Issue Type: Bug
>    Affects Versions: 4.2.0, 4.3.1
>            Reporter: Luke Chen
>            Assignee: Kuan Po Tseng
>            Priority: Blocker
>             Fix For: 4.4.0, 4.2.2, 4.3.2
>
>
> 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)