New submission from Nate <pm62...@nate.sh>:

In multiprocessing/reduction.py, there is a hack workaround in the sendfds() 
and recvfds() methods for darwin, as determined by the "ACKNOWLEDGE" constant. 
There is a reference to issue #14669 in the code related to why this was added 
in the first place. This bug exists in both 3.6.3 and the latest 3.7.0a2.

When a file descriptor is received, this workaround/hack sends an 
acknowledgement message to the sender. The problem is that this completely 
breaks Duplex pipes depending on the timing of the acknowledgement messages, as 
your "sock.send(b'A')" and "sock.recv(1) != b'A'" calls are being interwoven 
with my own messages.

Specifically, I have a parent process with child processes. I send socket file 
descriptors from the parent to the children, and am also duplexing messages 
from the child processes to the parent. If I am in the process of 
sending/receiving a message around the same time as your workaround is 
performing this acknowledge step, then your workaround corrupts the pipe. 

In a multi-process program, each end of a pipe must only be read or written to 
by a single process, but this workaround breaks this requirement. A different 
workaround must be found for the original bug that prompted this "acknowledge" 
step to be added, because library code must not be interfering with the duplex 
pipe.

----------
components: Library (Lib)
messages: 307649
nosy: frickenate
priority: normal
severity: normal
status: open
title: multiprocessing: passing file descriptor using reduction breaks duplex 
pipes on darwin
type: behavior
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32220>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to