Conversation
HAVE_EPOLL_PWAIT2 only tells whether the libc exports the wrapper, which glibc does since 2.35 regardless of the running kernel. A PHP built on a kernel with epoll_pwait2 and run on one older than 5.11 gets ENOSYS from every Context::wait() call, which makes the epoll backend and thus the Auto backend unusable. The same happens under emulation layers that do not implement the syscall. Try epoll_pwait2 first and on ENOSYS or ENOTSUP switch the process to epoll_wait with a millisecond timeout, retrying the current call so the failure is never visible to the caller. The flag is process wide since kernel support is the same for every thread, and it is atomic so the first concurrent waits in a ZTS build do not race on it.
devnexen
reviewed
Sep 21, 2026
| nfds = epoll_wait(backend_data->epoll_fd, backend_data->events, max_events, timeout_ms); | ||
| } | ||
|
|
||
| if (nfds > 0) { |
Member
There was a problem hiding this comment.
nit: I get 'ndfs' may be unitialized [-Wmaybe-uninitialized].
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
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.
HAVE_EPOLL_PWAIT2only means the libc exports the wrapper, which glibc does since 2.35 regardless of the running kernel. A PHP built on a kernel withepoll_pwait2and run on one older than 5.11 getsENOSYSfrom everyContext::wait(), which makes the epoll backend and thusBackend::Autounusable. This is the normal shape for Docker images, distro packages and static builds, and it also happens under emulation layers that lack the syscall, as seen in #23478.Try
epoll_pwait2first and onENOSYSorENOTSUPswitch the process toepoll_wait, retrying the current call so the caller never sees the error. The flag is process-wide and atomic so ZTS builds do not race on it.The configure check is unchanged, so the plain link check keeps working when cross-compiling.
Alternative to #23478.