apoorvmittal10 opened a new pull request, #24425: URL: https://github.com/apache/kafka/pull/24425
maybeRemoveAndNotifyListenersOnMemberLeave reads the session under the cache lock but notifies the listener outside it. If the member reconnects in between and a new session is created for the same key on a different connection, onMemberLeave -> releaseSession -> cache.remove(key) removes the new session instead of the old one and releases the acquired records of a member which has not left the group. The disconnect handling is now tied to the connection id: the listener receives the disconnected connection id, and the session is only removed (by the listener or the cache's trailing removal) if the session cached at the key still belongs to that connection. A session that was already replaced by a reconnect is left untouched and nothing is released. Additionally, the session's partition map is now iterated under the session lock when collecting the partitions to release, as done by every other reader of the partition map, since a concurrent share fetch may modify it. An integration test verifies, against the broker's share session cache, that a client disconnect evicts the share session, leaves no members for the group in the cache and releases the acquired records, which are then redelivered over the new share session. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
