[issue28708] Low FD_SETSIZE limit on Windows

Andrei Zene report at bugs.python.org
Mon Jun 10 08:30:26 EDT 2019


Andrei Zene <andrei.zene at outlook.com> added the comment:

I have updated PR 13842(https://github.com/python/cpython/pull/13842) to dynamically alocate the fd_sets on windows.

I did some testing on windows with the following two paterns:
1. 10000 transient clients: (open connection, send message, close connection)
2. 1024 permanent clients: (open connection, then in infinite loop: (read message, send message back))

Everything seemed to be fine.

I didn't do any testing on Linux.

On windows I also had to remove the if that vstinner added to check if the greatest file descriptor is greater than the setsize. That condition always failed for me on Windows. Apparently, according to: https://docs.microsoft.com/en-us/windows/desktop/api/winsock2/nf-winsock2-select, windows ignores nfds and "is included only for compatibility with Berkeley sockets." The documentation also states that the FD_ "macros are compatible with those used in the Berkeley software, but the underlying representation is completely different.", and: "Internally, socket handles in an fd_set structure are not represented as bit flags as in Berkeley Unix. Their data representation is opaque."

This is why I chose to determine setsize based on the inputs. If you think that's not going to work, please say why :)

----------

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


More information about the Python-bugs-list mailing list