[docs] [issue12488] multiprocessing.Connection does not communicate pipe closure between parent and child

Sye van der Veen report at bugs.python.org
Wed Apr 25 15:25:55 CEST 2012

Sye van der Veen <syeberman at gmail.com> added the comment:

This issue _does_ exist on Windows, and is not limited to the case where the master process exits before its children.  The following code, which is almost exactly that from the 2.7.3 documentation, deadlocks on Win7 (Py3.2 and 2.7) and WinXP (Py3.2 and 2.6):

    from multiprocessing import Process, Pipe
    import sys

    def f(conn):
        #conn.send([42, None, 'hello'])  # uncomment second

    if __name__ == "__main__":
        parent_conn, child_conn = Pipe()
        p = Process(target=f, args=(child_conn,))
        #child_conn.close()  # uncomment first
        sys.stdout.write( "about to receive\n" )
        sys.stdout.write( "%s\n"%parent_conn.recv() )
        sys.stdout.write( "received\n" )

If you "uncomment first", recv raises an EOFError; if you also "uncomment second", recv succeeds.

If this behaviour is the same on other platforms, then it seems all that is required is to update the documentation.

nosy: +syeberman
versions: +Python 2.6

Python tracker <report at bugs.python.org>

More information about the docs mailing list