expressif / pecl-event-libevent

PHP7 Libevent - event notification
http://pecl.php.net/package/libevent
56 stars 16 forks source link

invalid file descriptor passed #19

Open sm2017 opened 7 years ago

sm2017 commented 7 years ago

PR is created https://github.com/expressif/pecl-event-libevent/pull/18

ichiriac commented 7 years ago

Thanks @sm2017,

This issue is related to https://github.com/expressif/pecl-event-libevent/issues/14#issuecomment-285207819

Actual output is :

Warning: event_set(): invalid file descriptor passed in /home/travis/build/expressif/pecl-event-libevent/tests/libevent008.php on line 7
bool(false)

Not sure, did it pass on original version PHP5 version ?

sm2017 commented 7 years ago

I try it on PHP 5.6 before , It works

ichiriac commented 7 years ago

Thanks, I'll investigate it

ichiriac commented 7 years ago

A similar problem here :

https://github.com/walkor/Workerman/blob/master/Events/Libevent.php#L100

See https://github.com/expressif/pecl-event-libevent/issues/11#issuecomment-286056747 for more details.

Using stream_socket_client function to listen

ichiriac commented 7 years ago

@sm2017 As I'm working on windows for debugging I can't use workerman because of posix signals. I've found that by avoiding to cast the ressource as int it works.

On https://github.com/walkor/Workerman/blob/master/Events/Libevent.php#L100 can you remove the int statement and try again.

Meanwhile I'm working on this conversion problem.

ichiriac commented 7 years ago

Hi @sm2017,

Can you try again, I've fixed the int cast on resources and timer error. Last thing I've didn't check yet is signals (hard to test).

It still fails with a segfault, but I have my debug environement on windows and I can test your project only on ubuntu. Could you help me to isolate the bug with a standalone php code.