Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Zookeeper >> mail # user >> How to deal with fork() properly when using the zkc mt lib


+
Jonathan Simms 2012-05-10, 19:45
Copy link to this message
-
Re: How to deal with fork() properly when using the zkc mt lib
Hi Jonathan,

It would be very difficult to share multi-threaded zk handle with
child process. I'm surprised it actually works on mac. I think saving
session id/password and re-establishing the session in the child
process is more robust and platform independent.

Thanks!
--Michi

On Thu, May 10, 2012 at 12:45 PM, Jonathan Simms <[EMAIL PROTECTED]> wrote:
> 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?
+
Jonathan Simms 2012-05-10, 23:11
+
Martin Kou 2012-05-10, 23:51
+
Martin Kou 2012-05-10, 23:53
+
Jonathan Simms 2012-05-13, 03:06
+
Jonathan Simms 2012-05-11, 01:46
+
Jonathan Simms 2012-05-11, 04:19
+
Martin Kou 2012-05-11, 06:41
+
Jonathan Simms 2012-05-13, 02:42
+
Michi Mutsuzaki 2012-05-10, 23:49