Title: Multiprocessing module hangs on on Linux
Type: behavior Stage:
Components: IO Versions: Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: to7m
Priority: normal Keywords:

Created on 2020-12-13 23:37 by to7m, last changed 2020-12-14 18:26 by to7m.

Messages (1)
msg382945 - (view) Author: (to7m) Date: 2020-12-13 23:37
As best I can tell, sometimes when a Listener or Connection is not properly initialised, the Client fails to communicate properly with it. Instead of raising an exception, the Client hangs.

from multiprocessing.connection import Listener

while True:
    with Listener(("localhost", 10000), authkey=b"test") as listener:
        with listener.accept() as connection:
            print(connection.recv()) (intended as a stress test):

from multiprocessing.connection import Client

for i in range(1000):
    successfully_sent = False
    while not successfully_sent:
            with Client(("localhost", 10000), authkey=b"test") as client:
        except (ConnectionRefusedError, ConnectionResetError):
        successfully_sent = True

Also noteworthy: I posted on StackExchange ( and it seems that the code there (only 1000 messages) took around an hour to run for a Windows user, whereas it would take less than a second to successfully run on Linux.
Date User Action Args
2020-12-14 18:26:27to7msetfiles: -
2020-12-13 23:37:58to7mcreate