Skip to content

EventBaseConfig::FEATURE_FDS not supported on Windows #189

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
inri13666 opened this issue Apr 17, 2019 · 6 comments · Fixed by #205
Closed

EventBaseConfig::FEATURE_FDS not supported on Windows #189

inri13666 opened this issue Apr 17, 2019 · 6 comments · Fixed by #205

Comments

@inri13666
Copy link

If I use https://pecl.php.net/package/event library on Windows then I got following error out of the box

PHP Warning:  EventBase::__construct(): event_base_new_with_config: no event mechanism available

After small investigation I found that if following line commented then all works as expected
https://github.com/reactphp/event-loop/blob/master/src/ExtEventLoop.php#L47

$config->requireFeatures(EventBaseConfig::FEATURE_FDS);

Examples

Server: https://github.com/inri13666/web-socket-echoserver
Client: https://github.com/inri13666/web-socket-test

Library Info

composer show | grep loop
react/event-loop                     v1.1.0  ReactPHP's core reactor event loop that libraries can use for evented I/O.

Environment

systeminfo | findstr /B /C:"OS Version" /C:"System Type" /C:"System Locale"

OS Version: 10.0.17763 N/A Build 17763
System Type: x64-based PC
System Locale: en-us;English (United States)

php -i | findstr /B /C:"PHP Version" /C:"Architecture" /C:"Compiler" /C:"Configure Command" /C:"Zend Extension Build"

PHP Version 7.1.26
Compiler MSVC14 (Visual C++ 2015)
Architecture x64
Zend Extension Build API320160303,TS,VC14

Configure Command: cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-pdo-oci=c:\php-snap-build\deps_aux\oracle\x64\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-snap-build\deps_aux\oracle\x64\instantclient_12_1\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--without-analyzer" "--with-pgo"

PHP Extensions

php -m
[PHP Modules]
bcmath
bz2
calendar
com_dotnet
Core
ctype
curl
date
dom
event <====
exif
fileinfo
filter
gd
hash
iconv
intl
json
ldap
libxml
mbstring
mcrypt
memcache
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pdo_sqlsrv
pgsql
Phar
readline
Reflection
session
SimpleXML
soap
sockets
SPL
sqlsrv
standard
tokenizer
wddx
xdebug
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib

[Zend Modules]
Xdebug
@clue
Copy link
Member

clue commented Apr 17, 2019

@inri13666 Thanks for reporting and providing the platform info, it looks like this might in fact be a bug on Windows with ext-event.

Can you verify this by running the test suite and showing its output prior to your change and with your change applied? If this fixes the problem, a simple PR with your changes would be much appreciated! :shipit:

@inri13666
Copy link
Author

inri13666 commented Apr 18, 2019

Actual master's phpunit results on Windows platform
phpunit-master.txt

If I commented out mentioned line
phpunit-patch.txt

Later I'll prepare PR for this error
EventBase::__construct(): event_base_new_with_config: no event mechanism available

But right now I'm not sure how to fix on windows

1) React\Tests\EventLoop\Timer\ExtEventTimerTest::testAddPeriodicTimerCancelsItself
Failed asserting that 0.0043990612030029297 is equal to 0.0050000000000000001 or is greater than 0.0050000000000000001.

It would be nice to have test builds for windows hosts for example here https://www.appveyor.com/
It's Free for open-source projects https://www.appveyor.com/pricing/

Library issue https://bitbucket.org/osmanov/pecl-event/issues/53/eventbaseconfig-feature_fds-not-supported

@ghost
Copy link

ghost commented Apr 28, 2019

FEATURE_FDS allows file descriptors as well as sockets to be watched, removing this feature is a BC. The factory should probably just skip the ext-event loop if the OS is Windows. On *nix the FEATURE_FDS flag works without any issues, so I don't see any improvement by removing the feature.

libevent supports Windows IOCP, related pecl-event issue for reference: https://bitbucket.org/osmanov/pecl-event/issues/54/libevent-iocp-backed-implementations

@clue
Copy link
Member

clue commented Dec 23, 2019

@inri13666 Thank you for your patience, I've tried to reproduce this locally but have been unable to get ext-event running on Windows so far. Can you provide some instructions on how to best reproduce your setup on a clean Windows 10 installation so I can look into providing an automated test setup for this project?

The unrelated build error regarding timers is going to be fixed via #203.

@inri13666
Copy link
Author

inri13666 commented Dec 24, 2019

The DLL can be downloaded here https://pecl.php.net/package/event

I have tested it with following extension version

event
Event support => enabled
Sockets support => enabled
Debug support => disabled
Extra functionality support including HTTP, DNS, and RPC => enabled
OpenSSL support => disabled
Thread safety support => enabled
Extension version => 2.4.2
libevent2 headers version => 2.0.22-stable

PHP version

PHP Version => 7.1.26

System => Windows NT DESKTOP-13666 10.0 build 17763 (Windows 10) AMD64
Build Date => Jan  9 2019 21:47:23
Compiler => MSVC14 (Visual C++ 2015)
Architecture => x64
Configure Command => cscript /nologo configure.js  "--enable-snapshot-build" "--enable-debug-pack" "--with-pdo-oci=c:\php-snap-build\deps_aux\oracle\x64\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-snap-build\deps_aux\oracle\x64\instantclient_12_1\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--without-analyzer" "--with-pgo"
Server API => Command Line Interface
Virtual Directory Support => enabled
Configuration File (php.ini) Path => C:\Windows
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20160303
PHP Extension => 20160303
Zend Extension => 320160303
Zend Extension Build => API320160303,TS,VC14
PHP Extension Build => API20160303,TS,VC14

Full info here https://gist.github.com/inri13666/1e8d4e60ede974b97f86ed64a1fdb0e1

@clue clue added this to the v1.1.1 milestone Dec 24, 2019
@clue
Copy link
Member

clue commented Dec 24, 2019

@inri13666 Thank you, I've been able to reproduce this locally with the help of @sitedyno (ext-event needs to be loaded after ext-sockets) and have prepared a PR to add an automated test on Windows and fix this issue. Expect this PR soon, this is currently waiting for #203/#204 first 👍

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