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: use poll() if existing, avoid poll() with no sockets #15096

Closed
wants to merge 1 commit into from

Conversation

bagder
Copy link
Member

@bagder bagder commented Sep 30, 2024

poll() on macOS 10.12 was deemed broken in 2016 when we discovered that it misbehaves when provided with no sockets to wait for. The HAVE_POLL_FINE is used to mark a poll() implementation that behaves correctly: it should still wait the timeout time.

curl has therefore opted to use select() on Apple operating systems ever since. To avoid the risk that this or other breakage cause problems.

However, using select() internally is also bad because it suffers from problems when using file descriptors beyond 1024.

This change makes curl use poll() if there is one present, but if there is no sockets to wait for it avoids using poll() and instead falls back to select() - but without any sockets to wait for there is no 1024 problem. This removes all previous special-handling involving HAVE_POLL_FINE.

ref: https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/

@dfandrich

This comment was marked as outdated.

poll() on macOS 10.12 was deemed broken in 2016 when we discovered that
it misbehaves when provided with no sockets to wait for. The
HAVE_POLL_FINE is used to mark a poll() implementation that behaves
correctly: it *should* still wait the timeout time.

curl has therefore opted to use select() on Apple operating systems ever
since. To avoid the risk that this or other breakage cause problems.

However, using select() internally is also bad because it suffers from
problems when using file descriptors beyond 1024.

This change makes poll() used if it is present, but if there is no
sockets to wait for it avoids using poll() and instead falls back to
select() - but without any sockets to wait for there is no 1024 problem.

This removes all previous special-handling involving HAVE_POLL_FINE.

ref: https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/

Closes #15096
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants