[
https://issues.apache.org/jira/browse/KAFKA-20064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chia-Ping Tsai reopened KAFKA-20064:
------------------------------------
reopen this since the 4.0 backport is not finished yet
> 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)