[issue4892] Sending Connection-objects over multiprocessing connections fails

James Hutchison report at bugs.python.org
Sat Apr 7 00:19:21 CEST 2012

James Hutchison <jamesghutchison at gmail.com> added the comment:

This is an issue for me (Python 3.2). I have a custom pool that sends arguments for a function call over a pipe. I cannot send another pipe as an argument. 

Tim's workaround also does not work for me (win xp 32bit and 64bit)

>From what I can tell, you can only send a connection as a direct argument to a function call. This limits what I can do because I cannot introduce new pipes to a worker process after it is instantiated.

Using this code:

def main():
    from multiprocessing import Pipe, reduction
    i, o = Pipe()
    reduced = reduction.reduce_connection(i)
    newi = reduced[0](*reduced[1])

if __name__ == "__main__":

This is my output:

<read-write PipeConnection, handle 1760>
(<function rebuild_connection at 0x00FD4C00>, (('\\\\.\\pipe\\pyc-3156-1-q5wwnr', 1756, False), True, True))
<read-write Connection, handle 1720>
Traceback (most recent call last):
  File "H:\mti\secure\Flash\Reliability\Perl_Rel\Ambyx\James\bugs\test.py", line 47, in <module>
  File "H:\mti\secure\Flash\Reliability\Perl_Rel\Ambyx\James\bugs\test.py", line 43, in main
IOError: [Errno 10038] An operation was attempted on something that is not a socket

As you can see, the handle changes

nosy: +Jimbofbx

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list