Does your code catch the auth packets in-flight? Yeah I tried to repro it with similar code (also with close()) but with no luck. :(
From: Raúl Gutiérrez Segalés [email protected] Reply: [email protected] [email protected] Date: April 26, 2014 at 9:58:05 AM To: [email protected] [email protected] Cc: [email protected] [email protected] Subject: Re: Zookeeper C client fail to deliver a session event On 25 April 2014 11:20, Raúl Gutiérrez Segalés <[email protected]> wrote: > On 25 April 2014 11:18, Raúl Gutiérrez Segalés <[email protected]>wrote: > >> On 25 April 2014 10:15, Yan Xu <[email protected]> wrote: >> >>> Hi zookeeper-user, >>> >>> When I was triaging an issue with my ZK wrapper I think I found that >>> during >>> disconnection ZK client has failed to deliver the session event to the >>> watcher (but logged it). >>> >>> The log shows: >>> >>> 2014-04-23 23:50:30,324:990(0x7f75d4ba9940):ZOO_INFO@check_events@1703: >>> initiated connection to server [<...>:2181] >>> 2014-04-23 23:50:31,603:990(0x7f75d4ba9940):ZOO_INFO@check_events@1750: >>> session establishment complete on server [<...>:2181], >>> sessionId=0x2456db1b7d32534, negotiated timeout=10000 >>> ... >>> 2014-04-23 >>> 23:50:38,925:990(0x7f75d4ba9940):ZOO_ERROR@handle_socket_error_msg@1643: >>> Socket [<...>:2181] zk retcode=-7, errno=110(Connection timed out): >>> connection to <...>:2181 timed out (exceeded timeout by 636ms) >>> 2014-04-23 23:50:38,925:990(0x7f75d4ba9940):ZOO_WARN@zookeeper_interest >>> @1557: >>> Exceeded deadline by 1842ms >>> 2014-04-23 23:50:38,925:990(0x7f75d4ba9940):ZOO_INFO@check_events@1703: >>> initiated connection to server [<...>:2181] >>> 2014-04-23 23:50:38,927:990(0x7f75d4ba9940):ZOO_INFO@check_events@1750: >>> session establishment complete on server [<...>:2181], >>> sessionId=0x2456db1b7d32534, negotiated timeout=10000 >>> >> >>> which indicates that ZK client state transitioned from CONNECTED -> >>> CONNECTING -> CONNECTED. >>> >>> But my wrapper code was expecting a watcher event with ZOO_SESSION_EVENT >>> & >>> ZOO_CONNECTING_STATE but never got one. >>> The events for the CONNECTED state before and after the disconnection >>> were >>> delivered. >>> >>> >> Was auth performed in the missing parts of the log? If so I guess you >> could take the first branch here: >> >> >> https://github.com/apache/zookeeper/blob/branch-3.4/src/c/src/zookeeper.c#L1224 >> >> >> thus not missing the PROCESS_SESSION_EVENT(zh, ZOO_CONNECTING_STATE) >> call. >> > > Meant "thus missing". Lack of coffee :-) > > I wonder if this could happen when you have an AUTH packet in-flight. > Failing to get a repro with https://gist.github.com/rgs1/11325061 so far. -rgs
