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

LibEvent issue #130

Closed
sm2017 opened this issue Jan 9, 2017 · 18 comments
Closed

LibEvent issue #130

sm2017 opened this issue Jan 9, 2017 · 18 comments
Labels

Comments

@sm2017
Copy link
Contributor

sm2017 commented Jan 9, 2017

When I switch to libevent I have this issue

PHP Warning:  stream_set_blocking(): supplied resource is not a valid stream resource in /home/app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 263

Warning: stream_set_blocking(): supplied resource is not a valid stream resource in /home/app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 263
PHP Warning:  stream_set_read_buffer(): supplied resource is not a valid stream resource in /home/app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 266

Warning: stream_set_read_buffer(): supplied resource is not a valid stream resource in /home/app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 266
PHP Warning:  socket_import_stream(): supplied resource is not a valid stream resource in /home/app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 270

Warning: socket_import_stream(): supplied resource is not a valid stream resource in /home/app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 270
PHP Warning:  socket_set_option() expects parameter 1 to be resource, boolean given in /home/app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 271

Warning: socket_set_option() expects parameter 1 to be resource, boolean given in /home/app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 271
PHP Warning:  socket_set_option() expects parameter 1 to be resource, boolean given in /home/app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 272

Warning: socket_set_option() expects parameter 1 to be resource, boolean given in /home/app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 272
PHP Warning:  event_set(): fd argument must be either valid PHP stream or valid PHP socket resource in /home/app/vendor/workerman/workerman/Events/Libevent.php on line 105

Warning: event_set(): fd argument must be either valid PHP stream or valid PHP socket resource in /home/app/vendor/workerman/workerman/Events/Libevent.php on line 105
PHP Warning:  event_set(): fd argument must be either valid PHP stream or valid PHP socket resource in /home/app/vendor/workerman/workerman/Events/Libevent.php on line 105

Warning: event_set(): fd argument must be either valid PHP stream or valid PHP socket resource in /home/app/vendor/workerman/workerman/Events/Libevent.php on line 105

@walkor
Copy link
Owner

walkor commented Jan 9, 2017

What is the version of your php?

@sm2017
Copy link
Contributor Author

sm2017 commented Jan 9, 2017

I use PHP 7.0.14 and install https://github.com/expressif/pecl-event-libevent

@walkor
Copy link
Owner

walkor commented Jan 9, 2017

I think this is the issue of https://github.com/expressif/pecl-event-libevent.

@sm2017
Copy link
Contributor Author

sm2017 commented Jan 9, 2017

I switch to EV and have this error

PHP Warning:  Ev::run(): Libev error(0): Success in /home/app/vendor/workerman/workerman/Events/Ev.php on line 171

Warning: Ev::run(): Libev error(0): Success in /home/app/vendor/workerman/workerman/Events/Ev.php on line 171
WORKER EXIT UNEXPECTED 

@walkor
Copy link
Owner

walkor commented Jan 9, 2017

Please use event extension.
So far , the extension of libev or libevent are not stable enough for php7.

@sm2017
Copy link
Contributor Author

sm2017 commented Jan 9, 2017

I use before libev in php7 with workerman , before you switch to React , but for test I comment
https://github.com/walkor/Workerman/blob/e3b1eea5ef24cb1bf394541a1ade35143c0d73b0/Worker.php#L854-L856
to prevent react but same issue , I dont know why

Please use event extension.

How can I install event extension for PHP7 . I search web but don't find extension for PHP7

@sukui
Copy link
Contributor

sukui commented Jan 9, 2017

@sm2017
https://pecl.php.net/package/event

@sm2017
Copy link
Contributor Author

sm2017 commented Jan 10, 2017

I install event but I have new issue

Now my event handler is React using \Workerman\Events\React\ExtEventLoop , but my EV_READ event listener is not working , it works well with \Workerman\Events\React\StreamSelectLoop

@sm2017
Copy link
Contributor Author

sm2017 commented Jan 10, 2017

For test I comment
https://github.com/walkor/Workerman/blob/e3b1eea5ef24cb1bf394541a1ade35143c0d73b0/Worker.php#L854-L856

Now my event loop is Workerman\Events\Event , I have this Warning

Warning: Event::add(): Epoll ADD(1) on fd 24091136 failed. Old events were 0; read change was 1 (add); write change was 0 (none); close change was 0 (none): Bad file descriptor in /home/app/vendor/workerman/workerman/Events/Event.php on line 94
PHP Warning:  Event::add(): Failed adding event in /home/app/vendor/workerman/workerman/Events/Event.php on line 94

Why I dont have this error for \Workerman\Events\React\ExtEventLoop ?

WHY I HAVE NO ISSUE WITH \Workerman\Events\React\StreamSelectLoop ? WHY?!!?

@walkor
Copy link
Owner

walkor commented Jan 10, 2017

Show your codes please.

@sm2017
Copy link
Contributor Author

sm2017 commented Jan 10, 2017

$connection = pg_connect("host=localhost port=5432 dbname=mary");
$socket = pg_socket($connection);
Worker::$globalEvent->add($socket, EventInterface::EV_READ, function(){
     //My Codes
});

@walkor
Copy link
Owner

walkor commented Jan 10, 2017

Looks like Epoll does not support the resource of pg_connect returned.

@sm2017
Copy link
Contributor Author

sm2017 commented Jan 10, 2017

I test the code without workerman in a test file . it works well with libevent and php7

But in workerman when I enable libevent I have this error

Warning: stream_set_read_buffer(): supplied resource is not a valid stream resource in app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 266
PHP Warning:  socket_import_stream(): supplied resource is not a valid stream resource in app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 270

Warning: socket_import_stream(): supplied resource is not a valid stream resource in app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 270
PHP Warning:  socket_set_option() expects parameter 1 to be resource, boolean given in app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 271

Warning: socket_set_option() expects parameter 1 to be resource, boolean given in app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 271
PHP Warning:  socket_set_option() expects parameter 1 to be resource, boolean given in app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 272

Warning: socket_set_option() expects parameter 1 to be resource, boolean given in app/vendor/workerman/workerman/Connection/AsyncTcpConnection.php on line 272
PHP Warning:  event_set(): fd argument must be either valid PHP stream or valid PHP socket resource in app/vendor/react/event-loop/src/LibEventLoop.php on line 256

Warning: event_set(): fd argument must be either valid PHP stream or valid PHP socket resource in app/vendor/react/event-loop/src/LibEventLoop.php on line 256
PHP Warning:  event_add(): Unable to add event without an event base in app/vendor/react/event-loop/src/LibEventLoop.php on line 263

Warning: event_add(): Unable to add event without an event base in app/vendor/react/event-loop/src/LibEventLoop.php on line 263
PHP Warning:  event_del(): Unable to delete event without an event base in app/vendor/react/event-loop/src/LibEventLoop.php on line 251

@walkor
Copy link
Owner

walkor commented Jan 10, 2017

Can you test with event ?

@sm2017
Copy link
Contributor Author

sm2017 commented Jan 10, 2017

I run test script with event , this error occurred

PHP Warning:  Event::add(): Epoll ADD(1) on fd 19004832 failed. Old events were 0; read change was 1 (add); write change was 0 (none); close change was 0 (none): Bad file descriptor in app/vendor/react/event-loop/src/ExtEventLoop.php on line 259
PHP Warning:  Event::add(): Failed adding event in app/vendor/react/event-loop/src/ExtEventLoop.php on line 259

Workerman itself workes with event

@walkor
Copy link
Owner

walkor commented Jan 10, 2017

Yes, extension of libevent are not stable enough for php7.
Extension event seems not support resource of pg_connect returned.

@sm2017
Copy link
Contributor Author

sm2017 commented Feb 19, 2017

Hi again
Please see expressif/pecl-event-libevent#11 and reply
Thanks a lot

@walkor
Copy link
Owner

walkor commented Feb 19, 2017

I'm not good at C programming and I do not know whats's the problem with expressif/pecl-event-libevent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants