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. -rgs
