Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
ExtUvLoop: Fix reporting connection refused errors #207
This PR fixes reporting "connection refused" on affected installation of ExtUvLoop. I have started with adding relevant tests to the test matrix, fixing the underlying issue and included additional tests to run run this on Windows as well.
The underlying `epoll_wait()` reports `EPOLLOUT|EPOLLERR|EPOLLHUP` on the affected file descriptor, which `ext-uv` emits as an error code `EBADF` with no events attached. We explicitly re-enable all active events on this error event to invoke the writable listener for this condition to match other event loop implementations and successfully detect this as a refused connection attempt. All tests are now green.
For future reference, here's how to install this extension in a sample Docker container and all the commands I've used to debug this issue:
docker run -it -v /home/me/workspace:/workspace --workdir=workspace ubuntu:latest bash apt update apt-get install -y software-properties-common add-apt-repository ppa:ondrej/php -y apt-get install -y libuv1-dev php-pear php-dev strace pecl install uv-beta echo "extension=uv" >> "$(php -r 'echo php_ini_loaded_file();')" php -m cd /workspace strace php examples/14-http-client-async.php php -r 'var_dump((new ReflectionClass("UV"))->getConstants());' vendor/bin/phpunit
Now let's get this shipped!