Skip to content

Fix non selectable socket#683

Open
DeckerSU wants to merge 2 commits intodevfrom
fix-non-selectable-socket
Open

Fix non selectable socket#683
DeckerSU wants to merge 2 commits intodevfrom
fix-non-selectable-socket

Conversation

@DeckerSU
Copy link

@DeckerSU DeckerSU commented Mar 13, 2026

This patch adds a check to avoid using select() on sockets that are not
selectable (i.e. socket descriptor >= FD_SETSIZE). On platforms where
select() is used for non-blocking connect timeouts, attempting to use
FD_SET on a large socket descriptor would trigger undefined behavior
and could lead to a crash.

Now, if the socket is non-selectable, the connection attempt will fail
gracefully with a log message instead of causing an abort. This improves
stability on systems with high file descriptor allocation or large
ulimit settings.

p.s. Also it includes #682 .

This patch adds a check to avoid using select() on sockets that are not
selectable (i.e. socket descriptor >= FD_SETSIZE). On platforms where
select() is used for non-blocking connect timeouts, attempting to use
FD_SET on a large socket descriptor would trigger undefined behavior
and could lead to a crash.

Now, if the socket is non-selectable, the connection attempt will fail
gracefully with a log message instead of causing an abort. This improves
stability on systems with high file descriptor allocation or large
ulimit settings.

- DeckerSU/KomodoOcean#113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant