Re: objects added via ZEO ClientStorage not making it into the DB
Bill Janssen <[email protected]>
| Newsgroups | gmane.comp.web.zope.zodb |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the threading tip. Once I managed to suppress all existing ClientStorage instances before running multiprocessing.Process, things worked. Any other state like that I have to worry about? Bill On Saturday, April 23, 2016 at 6:41:37 AM UTC-7, Marius Gedminas wrote: > > 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.