Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select limitations difficult to handle #446

Open
FreeMasen opened this issue Jan 8, 2025 · 0 comments
Open

select limitations difficult to handle #446

FreeMasen opened this issue Jan 8, 2025 · 0 comments

Comments

@FreeMasen
Copy link

FreeMasen commented Jan 8, 2025

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.

  1. Return the invalid socket(s) as part of the error return, after the string "descriptor too large for set size"/"too many sockets".
  2. Swap out the underlying mechanism of socket.select to use poll as that is also posix compliant and should be generally portable.
  3. Provide an alternative socket.poll that uses the posix poll and allow callers to pick which API they want to use
  4. Stabilize and document getfd for 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant