zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Simms <slyp...@gmail.com>
Subject How to deal with fork() properly when using the zkc mt lib
Date Thu, 10 May 2012 19:45:31 GMT
Hi all,

I'm the maintainer of the ruby zookeeper library, and I'm having
trouble getting consistent behavior when a user calls fork(). When
developing it on MacOS (using 3.3.5), I was able to fork, then
immediately call zookeeper_close() in the child, and then create a new
handle. Testing on Linux, the behavior is much more unpredictable.
Regularly, it seems there are segfaults when calling zookeeper_close.
https://gist.github.com/22338464cd47e0e50970


So I guess my question is, is there any safe way to fork() while the
client is running?

Another possibility i thought of is to note the session id/passwd,
close the client, fork, then re-open with the same id/passwd to
re-establish the session in the parent.

Any recommendations?

Mime
View raw message