[ZODB-Dev] ZEO and fork()

Shane Hathaway shane at hathawaymix.org
Wed Jul 1 14:06:23 EDT 2009


Pedro Ferreira wrote:
> 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? Is there a workaround?

Importing ZEO.ClientStorage creates a thread, AFAIK.  Using threads with 
os.fork() is tricky: you have to ensure the threads get created *after* 
forking.  You've already done that, so is it not sufficient?

Shane


More information about the ZODB-Dev mailing list