[issue32220] multiprocessing: passing file descriptor using reduction breaks duplex pipes on darwin

Nate report at bugs.python.org
Tue Dec 5 23:08:14 EST 2017


Nate <pm62j9t at nate.sh> added the comment:

According to https://developer.apple.com/library/content/qa/qa1541/_index.html some bugs were fixed in 10.5. Not sure if the original attempt to patch the problem was happening on < 10.5, or if this was still a problem in 10.5+.

I can't for the life of me find it again, but I had found another source that claimed the true fixes for OS X came out with 10.7.

In any case, because this code is specifically part of the multiprocessing package, whereby it should be *expected* for multiple processes to be accessing the pipe, it's disastrous for this code to be reading/writing an acknowledge packet in this manner.

This is a hard case to test for, as timing matters. The duplex pipe doesn't get confused/corrupted unless one process is sending/receiving a message over the pipe at the same moment that another process is executing your acknowledge logic. It's reproducible, but not 100%.

Personally, I've restructured to using one pipe exclusively for file descriptor passing, and using a separate Queue (or Pipe pair) for custom message passing. If a better fix cannot be established, at a minimum the documentation for multiprocessing and the Pipe class should be updated with a big red warning about passing file descriptors on OS X/macOS/darwin.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32220>
_______________________________________


More information about the Python-bugs-list mailing list