You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Abhinav Dixit (Jira)" <ji...@apache.org> on 2026/10/26 10:35:00 UTC

[jira] [Commented] (KAFKA-21184) Fix the race condition in share session

    [ https://issues.apache.org/jira/browse/KAFKA-21184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18132320#comment-18132320 ] 

Abhinav Dixit commented on KAFKA-21184:
---------------------------------------

Another potential race condition in SharePartitionManager - cachedTopicIdPartitionsInShareSession, called by releaseSession when a client disconnects, iterates the live session partitionMap without synchronized(session) which could be problematic if there are other operations using share session. For example- updatePartitionOrder's remove()+mustAdd() that is introduced in PR [https://github.com/apache/kafka/pull/23951] 

> Fix the race condition in share session
> ---------------------------------------
>
>                 Key: KAFKA-21184
>                 URL: https://issues.apache.org/jira/browse/KAFKA-21184
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Chia-Ping Tsai
>            Assignee: Apoorv Mittal
>            Priority: Major
>
> {{maybeRemoveAndNotifyListenersOnMemberLeave}} reads the session under the lock, but {{onMemberLeave}} runs outside it. If another thread replaces the session in between, {{onMemberLeave}} -> {{releaseSession}} -> {{cache.remove(key)}} still removes by key, so it removes the new session instead of the old one.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)