[ZODB-Dev] ZEO and fork()
Jim Fulton
jim at zope.com
Thu Jul 2 09:45:58 EDT 2009
On Jul 1, 2009, at 1:08 PM, Pedro Ferreira wrote:
> Hello,
>
> We have a script that does something like this:
>
> import os
> from ZEO.ClientStorage import ClientStorage
>
> if os.fork()==0:
> print ClientStorage(('localhost',9675))
> print 'foo'
> else:
> print 'child: %s' % os.getpid()
>
> And it worked with ZODB 3.4, but we recently noticed that with 3.8 the
> child process hangs. But if we import ClientStorage only inside the
> process, it seems to work OK.
> Is this supposed to happen?
I'm not interested in trying to support carrying threads across forks.
I could fix this, but it would be a wildly low priority for me.
> Is there a workaround?
Yes, import ClientStorage after the fork.
BTW, your example script gets the child and parent backwards.
Jim
--
Jim Fulton
Zope Corporation
More information about the ZODB-Dev
mailing list