-
Notifications
You must be signed in to change notification settings - Fork 647
Description
Since the getfd method on the socket types in this project seems to be unstable as outlined in this comment from the tcp reference docs
Note: This is an internal method. Unlikely to be portable. Use at your own risk.
It is incredibly difficult to know which socket passed to select has caused this failure.
It is also very difficult to recover from this error since it is difficult to predict what FD will be returned by the OS at any given time and since an FD isn't allocated for unconnected sockets, there isn't a great way to surface an error if the FD is too large.
I see a few ways this could be solved.
- Return the invalid socket(s) as part of the error return, after the string
"descriptor too large for set size"/"too many sockets". - Swap out the underlying mechanism of
socket.selectto usepollas that is also posix compliant and should be generally portable. - Provide an alternative
socket.pollthat uses the posixpolland allow callers to pick which API they want to use - Stabilize and document
getfdfor all sockets on all platforms to at least give consumers an escape hatch
Does the project have a preference here? Personally I would love to see 2 if possible and would be happy to try and get a PR opened for the change