Good question, AFAIK, it’s not the case. The server will throw an SessionExpiredException during checkSession call as soon as the session is marked as isClosing. However, session expiration actually requires a transaction (of type OpCode.closeSession) which will be send to the leader to go through the quorum. The session and ephemeral node will only be removed after the transaction is committed and processed in the final processor on other nodes. Therefore, it seems to be possible for a client to connect to another server to see the node there. I am not entirely sure if it can use the same session id though, it seems possible as the session close is only based on the session expire time and there can be delays in session pings.
On Jan 25, 2017, at 8:53 AM, Jun Rao <jun...@gmail.com<mailto:jun...@gmail.com>> wrote: Hi, Does ZK guarantee that ephemeral nodes from a client are removed on the sever by the time the client receives a session expiration event? I am getting conflicting info on this ( https://issues.apache.org/jira/browse/KAFKA-4277). Could someone clarify? Thanks, Jun