Pre-fork and post-fork callback infrastructure ...
realrichardsharpe at gmail.com
Thu May 7 12:27:03 MDT 2015
On Thu, May 7, 2015 at 6:30 AM, Volker Lendecke
<Volker.Lendecke at sernet.de> wrote:
> On Wed, May 06, 2015 at 03:10:46PM -0700, Richard Sharpe wrote:
>> Hi folks,
>> I encountered a problem with the Zookeeper work I did a while ago
>> because the Zookeeper client library is not fork safe. I had to hack a
>> bunch of code in to reinit the connection to the Zookeeper server in
>> each child.
>> I notice that we already have reinit_after_fork and wondered whether
>> we should have some standard infrastructure for where things need to
>> be reinitialized after a fork.
>> The sort of thing I am thinking of is some registration routines that
>> allows a subsystem to register:
>> 1. A pre-fork callback. This would be called in the parent just before
>> the fork and passed an opaque pointer to a private data structure.
>> 2. A post-fork callback that would be called in the parent and the
>> child and passed the response from fork and an opaque pointer.
> man pthread_atfork
That's nice but I was not doing any forking ... the problems are
related to the assumptions made by the Zookeeper library.
More information about the samba-technical