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

Akhilesh Chaganti resolved KAFKA-14170.
---------------------------------------
    Resolution: Fixed

> 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
>            Reporter: Akhilesh Chaganti
>            Assignee: Akhilesh Chaganti
>            Priority: Blocker
>             Fix For: 3.3
>
>
> 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)

Reply via email to