Open njsmith opened 6 years ago
On further investigation, this is not actually a real issue, because Windows doesn't actually have any way to limit the number of socket handles you allocate; if you do a while True: sockets.append(socket.socket())
then it doesn't return any kind of error, it just eventually locks up the whole system because no processes can get any handles.
Paste of some discussion on #twisted
with @markrwilliams:
It would still be good to:
Double-check whether the list in SocketListener
works correctly
Actually provoke an EMFILE during tests (on non-Windows platforms only)
Looking at https://github.com/twisted/twisted/pull/996/ led me to investigate more the difference between
EMFILE
andWSAEMFILE
... the latter is the special "winsockets" version ofEMFILE
, and apparently they are actually different:And right now
serve_listeners
has special handling forEMFILE
, but notWSAEMFILE
... so it's probably broken.We should:
SocketListener
: https://github.com/python-trio/trio/blob/7b7b7d1431644233a2c06928802be6cdca2e35c6/trio/_highlevel_socket.py#L291-L311