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

[jira] [Resolved] (KAFKA-20064) A race condition in admin client can lead to the result future never being completed

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

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

My apologies, I realized these open issues will block [~christo_lolov]  from cutting the RC, so I'm going to resolve them now. I will make sure the backport 4.0 is handled shortly

> A race condition in admin client can lead to the result future never being completed
> ------------------------------------------------------------------------------------
>
>                 Key: KAFKA-20064
>                 URL: https://issues.apache.org/jira/browse/KAFKA-20064
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>    Affects Versions: 4.0.0
>            Reporter: Nikita Shupletsov
>            Assignee: Nikita Shupletsov
>            Priority: Major
>             Fix For: 4.2.0, 4.0.2, 4.1.2
>
>         Attachments: A_test_that_reproduces_the_issue.patch
>
>
> Here we make two independent calls that check the cache: [https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/admin/internals/AdminApiDriver.java#L118-L119]
> if the admin client is shared between multiple threads, there may be a situation when one request is initializing the AdminApiDriver, and the other one invalidates some values in the cache.
> E.g.:
> There are two partitions in the cache: 1,2. and two requests requesting offsets for both partitions.
> Thread1: calls uncachedLookupKeys, which returns an empty list, as both requested values are in the cache.
> Thread2: faced an issue with connecting to a node and invalidates the cache for partition 2.
> Thread1: calls cachedKeyBrokerIdMapping, which returns one 1.
> The future for partition 2 will never be completed, as we never created a request for it.
> An integration test that stages all these conditions and reproduces the issue is in the attachment



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