Re: objects added via ZEO ClientStorage not making it into the DB

Marius Gedminas <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <20160423100555.GA17691@platonas>
On Fri, Apr 22, 2016 at 09:51:01AM -0700, Bill Janssen wrote:
> I'm seeing missing objects.
> 
> Here's my scenario.  Python 2.7.11 on Ubuntu 15 (and 16), ZODB 4.2, ZEO 
> 3.7.0b3.  I start a parent process; it sets up a ZEO server, then uses 
> multiprocessing.Process to start a child process.  The child uses 
> ClientStorage to connect to the server, then adds an object.

Multiprocessing uses os.fork() a lot.  You need to be very careful about
that: ClientStorage relies on a dedicated communication thread to talk
to the ZEO server, and os.fork() kills all the threads in the child
process (except for the one calling os.fork()).  Things should work fine
if the communication thread is created *after* the fork, but things will
break badly if the thread is created before the fork.

You can use threading.enumerate() at the point where you're doing the
transaction.commit() in your child process to take a look at all the
threads and see if the ZEO communications thread is among them.

HTH,
Marius Gedminas
-- 
All programs have at least one bug remaining and can be optimized by one byte.
Thus, by mathematical induction, all programs can be reduced to one byte. And
it won't work.

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
signature.asc (application/pgp-signature, 173 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iD8DBQFXG0j+kVdEXeem148RAoFfAKCCqTXsrfsh8yx8mVfStt3a5NK5pACePjbD
Q+sdaL/1pcl76J/QegXSYco=
=7lps
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.