Multiprocessing Client connection, send call is blocking when multiple threads try to connect to IPC Server which is offline/down/not running
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- backend, networking
Research direction
Start at the multiprocessing.connection.Client entry point and reproduce the issue on Windows 10 with three threads while the IPC server is offline. Trace why only one call returns the connection-refused exception; done means every thread returns instead of remaining blocked, with regression coverage for this scenario.
Written by the indexing model from the issue text.
Description
Bug report
When multiple threads access send call of multiprocessing Client to connect to server via IPC, the threads are blocked forever. This occurs when IPC server is down and the client tries to connect to server.
CODE:
from multiprocessing.connection import Client
def ipc_send(data={}):
try:
address = ('localhost', 56000)
print("ipc address: ", address)
conn = Client(address, authkey="SOMESECRET")
conn.send(data)
res = conn.recv()
conn.close()
return True
except Exception as e:
print(e)
return None
As server is down, when ipc_send() is called by 3 different threads(including main thread), suprisingly only one thread has returned None with exception: [WinError 10061] No connection could be made because the target machine actively refused it.
It is trivial that Error would be connection refused as server is down, but only one thread has thrown the error and rest of the 2 threads are possibly blocked at
conn = Client(address, authkey="SOMESECRET")
Your environment
Python 3.8.8
OS: Windows 10.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 558
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python/cpython
-
docs pending
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
stdlib type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
stdlib type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
build type-bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
stdlib topic-email type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
OpenHands/extensions#626 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
CSCfi/sd-search-api#39 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
StevenBlack/hosts#3255 ·