amphp / parallel-functions

Simplified parallel processing for PHP based on Amp.
https://amphp.org/parallel-functions
MIT License
268 stars 18 forks source link

Not working example 5 #22

Closed yusufusta closed 4 years ago

yusufusta commented 4 years ago

I'm trying run example 5 but I'm getting error

PHP Warning:  include(/Users/yusufusta/Desktop/plf/vendor/amphp/process/lib/ProcessException.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(/Users/yusufusta/Desktop/plf/vendor/amphp/process/lib/ProcessException.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/process/lib/ProcessException.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/process/lib/ProcessException.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(/Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Failure.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(/Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Failure.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/amp/lib/Failure.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/amp/lib/Failure.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(/Users/yusufusta/Desktop/plf/vendor/amphp/parallel/lib/Context/ContextException.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(/Users/yusufusta/Desktop/plf/vendor/amphp/parallel/lib/Context/ContextException.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/parallel/lib/Context/ContextException.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/parallel/lib/Context/ContextException.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(/Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Failure.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(/Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Failure.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/amp/lib/Failure.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/amp/lib/Failure.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(/Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Failure.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(/Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Failure.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/amp/lib/Failure.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/amp/lib/Failure.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(/Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Failure.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(/Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Failure.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/amp/lib/Failure.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/amp/lib/Failure.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(/Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Failure.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(/Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Failure.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/amp/lib/Failure.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/amp/lib/Failure.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Fatal error:  Uncaught Error: Class 'Amp\Failure' not found in /Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Internal/Placeholder.php:177
Stack trace:
#0 /Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Coroutine.php(78): Amp\Coroutine->fail(Object(Error))
#1 /Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/functions.php(96): Amp\Coroutine->__construct(Object(Generator))
#2 /Users/yusufusta/Desktop/plf/vendor/amphp/parallel-functions/src/functions.php(60): Amp\call(Object(Closure))
#3 /Users/yusufusta/Desktop/plf/index.php(18): Amp\ParallelFunctions\parallelMap(Array, Object(Closure), Object(Amp\Parallel\Worker\DefaultPool))
#4 {main}
  thrown in /Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Internal/Placeholder.php on line 177

Fatal error: Uncaught Error: Class 'Amp\Failure' not found in /Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Internal/Placeholder.php:177
Stack trace:
#0 /Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Coroutine.php(78): Amp\Coroutine->fail(Object(Error))
#1 /Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/functions.php(96): Amp\Coroutine->__construct(Object(Generator))
#2 /Users/yusufusta/Desktop/plf/vendor/amphp/parallel-functions/src/functions.php(60): Amp\call(Object(Closure))
#3 /Users/yusufusta/Desktop/plf/index.php(18): Amp\ParallelFunctions\parallelMap(Array, Object(Closure), Object(Amp\Parallel\Worker\DefaultPool))
#4 {main}
  thrown in /Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Internal/Placeholder.php on line 177
PHP Warning:  include(/Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Loop/Internal/TimerQueueEntry.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(/Users/yusufusta/Desktop/plf/vendor/amphp/amp/lib/Loop/Internal/TimerQueueEntry.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/amp/lib/Loop/Internal/TimerQueueEntry.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/amp/lib/Loop/Internal/TimerQueueEntry.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(/Users/yusufusta/Desktop/plf/vendor/amphp/process/lib/ProcessException.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(/Users/yusufusta/Desktop/plf/vendor/amphp/process/lib/ProcessException.php): failed to open stream: Too many open files in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Warning:  include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/process/lib/ProcessException.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444

Warning: include(): Failed opening '/Users/yusufusta/Desktop/plf/vendor/composer/../amphp/process/lib/ProcessException.php' for inclusion (include_path='.:/usr/local/Cellar/php@7.2/7.2.30_1/share/php@7.2/pear') in /Users/yusufusta/Desktop/plf/vendor/composer/ClassLoader.php on line 444
PHP Fatal error:  Uncaught Error: Class 'Amp\Process\ProcessException' not found in /Users/yusufusta/Desktop/plf/vendor/amphp/process/lib/Internal/Posix/Runner.php:198
Stack trace:
#0 /Users/yusufusta/Desktop/plf/vendor/amphp/process/lib/Process.php(141): Amp\Process\Internal\Posix\Runner->kill(Object(Amp\Process\Internal\Posix\Handle))
#1 /Users/yusufusta/Desktop/plf/vendor/amphp/parallel/lib/Context/Process.php(395): Amp\Process\Process->kill()
#2 /Users/yusufusta/Desktop/plf/vendor/amphp/parallel/lib/Worker/Internal/WorkerProcess.php(57): Amp\Parallel\Context\Process->kill()
#3 /Users/yusufusta/Desktop/plf/vendor/amphp/parallel/lib/Worker/TaskWorker.php(64): Amp\Parallel\Worker\Internal\WorkerProcess->kill()
#4 [internal function]: Amp\Parallel\Worker\TaskWorker::Amp\Parallel\Worker\{closure}()
#5 {main}
  thrown in /Users/yusufusta/Desktop/plf/vendor/amphp/process/lib/Internal/Posix/Runner.php on line 198

Fatal error: Uncaught Error: Class 'Amp\Process\ProcessException' not found in /Users/yusufusta/Desktop/plf/vendor/amphp/process/lib/Internal/Posix/Runner.php:198
Stack trace:
#0 /Users/yusufusta/Desktop/plf/vendor/amphp/process/lib/Process.php(141): Amp\Process\Internal\Posix\Runner->kill(Object(Amp\Process\Internal\Posix\Handle))
#1 /Users/yusufusta/Desktop/plf/vendor/amphp/parallel/lib/Context/Process.php(395): Amp\Process\Process->kill()
#2 /Users/yusufusta/Desktop/plf/vendor/amphp/parallel/lib/Worker/Internal/WorkerProcess.php(57): Amp\Parallel\Context\Process->kill()
#3 /Users/yusufusta/Desktop/plf/vendor/amphp/parallel/lib/Worker/TaskWorker.php(64): Amp\Parallel\Worker\Internal\WorkerProcess->kill()
#4 [internal function]: Amp\Parallel\Worker\TaskWorker::Amp\Parallel\Worker\{closure}()
#5 {main}
  thrown in /Users/yusufusta/Desktop/plf/vendor/amphp/process/lib/Internal/Posix/Runner.php on line 198
trowski commented 4 years ago

Hi @Quiec!

The script has run into the open file limit set by your operating system. MacOS sets the limit to 1024 by default. You can raise it using ulimit -n 4096 in Terminal. That should be sufficient.

We plan to investigate if this limit can be raised automatically to avoid the confusion that can be caused for those unfamiliar with this OS limit.

yusufusta commented 4 years ago

It's working now. Thanks!