[issue29158] Possible glitch in the interaction of a thread and a multiprocessing manager

Davin Potts report at bugs.python.org
Wed Jan 4 17:20:29 EST 2017


Davin Potts added the comment:

There are too many things going on in this example -- it would be far easier to digest if the example could be simplified.

The general programming rule of thumb (completely unrelated to but still just as relevant to Python) that I think David might have been invoking is:  create processes first then create threads inside of them.  Otherwise, if you fork a process that has multiple threads going inside it, you should expect problems.  Assuming you're on a unix platform, it looks like you're creating threads then forking a process as well as doing it the other way around in another part of your code.

Different topic:  you mention killing the main process for server.py... which would likely kill the manager process referred to by shared_objects_manager... but you're creating a different manager process in bridge.py that is told to listen on the same port...


Without pulling apart your code further, I suspect confusion over how to use a Manager to share objects / data / information across processes.  If it helps, generally one process creates a manager instance (which itself results in the creation of a new process) and then other processes / threads created are created by that first process and given a handle on the manager instance or the objects managed by that manager.  I am a bit confused by your example but I hope that explanation helps provide some clarity?

----------
nosy: +davin

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29158>
_______________________________________


More information about the Python-bugs-list mailing list