You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Matthias J. Sax (Jira)" <ji...@apache.org> on 2024/06/07 17:59:00 UTC

[jira] [Updated] (KAFKA-14170) KRaft Controller: Possible NPE when we remove topics with any offline partitions in the cluster

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

Matthias J. Sax updated KAFKA-14170:
------------------------------------
    Fix Version/s: 3.3.0
                       (was: 3.3)

> KRaft Controller: Possible NPE when we remove topics with any offline partitions in the cluster
> -----------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-14170
>                 URL: https://issues.apache.org/jira/browse/KAFKA-14170
>             Project: Kafka
>          Issue Type: Bug
>          Components: kraft
>    Affects Versions: 3.3.0
>            Reporter: Akhilesh Chaganti
>            Assignee: Akhilesh Chaganti
>            Priority: Blocker
>             Fix For: 3.3.0
>
>
> When we remove a topic, it goes through the following function in KRaft Controller replay method for RemoveTopicRecord:
> {code:java}
> void removeTopicEntryForBroker(Uuid topicId, int brokerId) {
>     Map<Uuid, int[]> topicMap = isrMembers.get(brokerId);
>     if (topicMap != null) {
>         if (brokerId == NO_LEADER) {
>             offlinePartitionCount.set(offlinePartitionCount.get() - topicMap.get(topicId).length);
>         }
>         topicMap.remove(topicId);
>     }
> } {code}
> If the broker has any offline partitions but doesn't have offline partitions for the topic we're deleting, the above code will run into NPE because we directly access the `topicMap.get(topicId).length`



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