[ 
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)

Reply via email to