amp
amp copied to clipboard
Allow signal handling for Uv w/o 100% cpu usage
Ref #329
To be honest this could lend itself to its own Uv
specific example file, but here's something that could work regardless of driver used.
Again, downside is that the end of code execution is not in the signal handling function, but sometime after the Loop::run()
line.
Not a very good solution imo. Now the signal handler can't control the exit code.
I can't reproduce 100% CPU usage, but I get a warning:
Press Ctrl+C to exit...
^CCaught SIGINT, exiting...
PHP Warning: zend_signal: handler was replaced for signal (2) after startup in Unknown on line 0
I can't reproduce 100% CPU usage, but I get a warning:
Press Ctrl+C to exit... ^CCaught SIGINT, exiting... PHP Warning: zend_signal: handler was replaced for signal (2) after startup in Unknown on line 0
Using uv
as the driver? (I've currently got uv
0.2.4-3 if it matters)
Please try with the latest master
of https://github.com/bwoebi/php-uv.
Please try with the latest
master
of https://github.com/bwoebi/php-uv.
Alright, give me a hot minute to try it.
PS: Thanks for being so active, you guys are awesome.
Please try with the latest
master
of https://github.com/bwoebi/php-uv.Alright, give me a hot minute to try it.
PS: Thanks for being so active, you guys are awesome.
No luck. Same result.
I'm not sure this is worth putting too much work into unless someone else runs into the same issue. They can reference this conversation.
Which PHP version do you use?
Using the following:
PHP 7.4.2 (cli) (built: Jan 21 2020 11:35:20) ( NTS ) Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.2, Copyright (c), by Zend Technologies
If I switch from uv
to the native driver, no issues too.
Perhaps there's an issue in ext-uv
when calling exit
inside a watcher callback? Exit handling changed recently to throw an exception internally (not sure which PHP version this happened in).