[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

Antoine Pitrou report at bugs.python.org
Fri May 13 15:15:04 CEST 2011


Antoine Pitrou <pitrou at free.fr> added the comment:

> But Lib/multiprocessing/connection.py does:
> 
>     def _send_bytes(self, buf):
>         # For wire compatibility with 3.2 and lower
>         n = len(buf)
>         self._send(struct.pack("=i", len(buf)))
>         # The condition is necessary to avoid "broken pipe" errors
>         # when sending a 0-length buffer if the other end closed the pipe.
>         if n > 0:
>             self._send(buf)
> 
> This is definitely not atomic.

Indeed, it isn't, Pipe objects are not meant to be safe against multiple
access. Queue objects (in multiprocessing/queues.py) use locks so they
are safe.

----------

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


More information about the Python-bugs-list mailing list