UvDriver cannot scan empty dir
robberphex opened this issue · comments
For this code:
<?php
require __DIR__ . '/vendor/autoload.php';
use Amp\File;
use Amp\Loop;
use App\App;
Loop::run(function () {
$flist = yield File\scandir("/tmp/tmp/");
var_dump($flist);
});
/tmp/tmp
is empty dir
Run php72 -dmemory_limit=1024m /path/to/php.php
, it throw a excepiton:
PHP Fatal error: Uncaught Amp\File\FilesystemException: Failed reading contents from /tmp/tmp/ in /opt/pkgist/vendor/amphp/file/lib/UvDriver.php:420
Stack trace:
#0 [internal function]: Amp\File\UvDriver->Amp\File\{closure}(NULL, 0)
#1 /opt/pkgist/vendor/amphp/amp/lib/Loop/UvDriver.php(174): uv_run(Object(UVLoop), 1)
#2 /opt/pkgist/vendor/amphp/amp/lib/Loop/Driver.php(130): Amp\Loop\UvDriver->dispatch(true)
#3 /opt/pkgist/vendor/amphp/amp/lib/Loop/Driver.php(70): Amp\Loop\Driver->tick()
#4 /opt/pkgist/vendor/amphp/amp/lib/Loop.php(76): Amp\Loop\Driver->run()
#5 /opt/pkgist/bin/gc2(11): Amp\Loop::run(Object(Closure))
#6 {main}
thrown in /opt/pkgist/vendor/amphp/file/lib/UvDriver.php on line 420
But run env AMP_LOOP_DRIVER='\Amp\Loop\EvDriver' php72 -dmemory_limit=1024m /path/to/php.php
, it works normally:
array(0) {
}
Which version of libuv do you have? I've found this in the changelog.
php72-php-fpm-7.2.1-1.el7.remi.x86_64
php72-php-pecl-uv-0.2.2-2.el7.remi.x86_64
libuv-1.10.2-1.el7.x86_64
Thanks @trowski, fixed it upstream: amphp/ext-uv@72aa710