>> The documentation for zookeeper_close seems to indicate that the call will block until the session is cleaned up at the server or a failure occurs
There is no guarantee that after the call of zookeeper_close the session will be cleaned up. Similar for Java client's close as well. ZOK return code implies that the close request is sent to server and that's all. If you want to make sure ephemeral nodes gets cleaned up then it's better to use watchers than relying on return code of the close methods. On Tue, Apr 4, 2017 at 5:44 PM, svk <[email protected]> wrote: > Hi, > > I am using Zookeeper server ad C-client v3.4.1-alpha. > > The documentation for zookeeper_close seems to indicate that the call > will block until the session is cleaned up at the server or a failure > occurs(connection loss, out of memory, timeout etc). > > However I have observed a couple of times that zookeeper_close returns > '0' but the session is not closed at the server - some ephemeral nodes > still persist for a while. > > Looking at the source code for zookeeper_close, I see the condition below:- > > http://zookeeper.sourcearchive.com/documentation/3.2.2plus- > pdfsg3/zookeeper_8h_d739d8cb9288daded58d4cbdede83937.html# > d739d8cb9288daded58d4cbdede83937 > > -------------- > > if (inc_ref_counter(zh,0)!=0) { > adaptor_finish(zh); > return ZOK > <http://zookeeper.sourcearchive.com/documentation/3.2.2plus- > pdfsg3/zookeeper_8h_bb1a0a179f313b2e44ee92369c438a4c.html# > bb1a0a179f313b2e44ee92369c438a4c9677bf3e4face8afd292d31ecfd4dc5d>; > } > > ---------------- > Under what circumstances can this API return ZOK, and yet not succeed in > closing the session > > > Thanks, > SV > -- Cheers Michael.
