Skip to content

select limitations difficult to handle #446

@FreeMasen

Description

@FreeMasen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions