[issue44155] Race condition when using multiprocessing BaseManager and Pool in Python3

David Chen report at bugs.python.org
Mon May 24 04:11:43 EDT 2021


David Chen <chenzhuowansui at 163.com> added the comment:

After some investigation, i almost finally identified the root cause - it was caused by the following line in `Server` class in `manager.py` file:
```
self.listener = Listener(address=address, backlog=16)
```
i'm not sure where the magic number `16` came from, but it turned out it was not big enough for some powerful CPU(48 cores in my case), where the socket server starts refusing to accepting new connections if there are more than `16` unaccepted connections, i think this is why the code stuck at `Client -> answer_challenge` where attempting to create new connection to the server. After i change the number to `32`, this issue is gone.
IMO, a magic number here is not very suitable, maybe we could make this number configurable or use `cpu_count` to set it to a better number based on the CPU count.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44155>
_______________________________________


More information about the Python-bugs-list mailing list