-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
select: use poll() if existing, avoid poll() with no sockets #15096
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment was marked as outdated.
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
40e2e5a
to
40a0c0d
Compare
vszakats
added a commit
to curl/curl-for-win
that referenced
this pull request
Oct 7, 2024
This build-time flag no longer exists. curl/curl#15096 curl/curl@c72cefe
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Mar 5, 2025
Follow-up to c72cefe curl#15096
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Mar 5, 2025
Follow-up to c72cefe curl#15096
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Mar 6, 2025
Follow-up to c72cefe curl#15096
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Mar 7, 2025
Follow-up to c72cefe curl#15096
vszakats
added a commit
that referenced
this pull request
Mar 7, 2025
General tidy-ups, to identify and reduce duplications and potential issues, while also making the server modules compile as a single binary. - ensure unique symbols and no shadowing across server sources, by renaming variables. - move globals common to multiple servers into shared `util` module. - drop constants with a single use. - undef macro before re-using them across server sources. - move common functions into shared `util` module. - drop redundant static declarations. - disable IPv6 code when built without IPv6. - start syncing the 3 almost identical copies of `sockdaemon` function. - drop unused `timeval.h` header. - drop `poll()` from `wait_ms()`, for macOS, following an earlier core update. Follow-up to c72cefe #15096 Follow-up to 9213e4e #16525 Cherry-picked from #15000 Closes #16609
pps83
pushed a commit
to pps83/curl
that referenced
this pull request
Apr 26, 2025
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 curl#15096
pps83
pushed a commit
to pps83/curl
that referenced
this pull request
Apr 26, 2025
General tidy-ups, to identify and reduce duplications and potential issues, while also making the server modules compile as a single binary. - ensure unique symbols and no shadowing across server sources, by renaming variables. - move globals common to multiple servers into shared `util` module. - drop constants with a single use. - undef macro before re-using them across server sources. - move common functions into shared `util` module. - drop redundant static declarations. - disable IPv6 code when built without IPv6. - start syncing the 3 almost identical copies of `sockdaemon` function. - drop unused `timeval.h` header. - drop `poll()` from `wait_ms()`, for macOS, following an earlier core update. Follow-up to c72cefe curl#15096 Follow-up to 9213e4e curl#16525 Cherry-picked from curl#15000 Closes curl#16609
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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/