amphp / parallel

An advanced parallelization library for PHP, enabling efficient multitasking, optimizing resource use, and application responsiveness through multiple CPU threads.
MIT License
775 stars 64 forks source link

How to launch multiple blocking processes #112

Closed iNilo closed 1 year ago

iNilo commented 4 years ago

Terribly sorry for making an issue, but I've been stuck for a while.

I'm in the need to launch multiple blocking php scripts in a concurrent fashion. Its the same script 20 x times.

I've looked at https://github.com/amphp/parallel/blob/master/examples/process.php

and its child:

https://github.com/amphp/parallel/blob/master/examples/blocking-process.php

But I'm struggling to make it launch 20 children ( with different data )

I've got something like this:

$promises = [];
for($x = 0; $x <= 10; $x++)
{
    $process = new Process(__DIR__ . "/amp-runner.php");
    $process->start();
    $promises[] = $process->send(x);
}
$all_replies = Promise\wait(Promise\all($promises));
var_dump($all_replies);

But I can't get it to work.

enumag commented 4 years ago

What do you mean by "But I can't get it to work." ? What is it doing?

iNilo commented 4 years ago

As in, I'm seeking advise how actually achieve this.

As for what its doing:

PHP Fatal error:  Uncaught TypeError: Expected one of the following types: Amp\Promise, React\Promise\PromiseInterface; instance of Amp\Parallel\Context\Process given in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/functions.php:53
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php(373): Amp\Internal\createTypeError()
#1 /home/centos/web/public_html/cron/amp-delegator.php(83): Amp\Promise\all()
#2 {main}

So I figured I got to give it a promise, which it will then collect for me. I just can't seem to find the right combination of it all :/

enumag commented 4 years ago

One of the problems I can see is that $process->start(); also returns a Promise which you don't yield. I recommend you to not use the wait function but instead use Loop::run() yourself and yield the promises (or rather their groups with Promise\all()).

enumag commented 4 years ago

Also @kelunik already advised you in https://github.com/amphp/parallel/issues/111 to use amphp/process instead of amphp/parallel. Have you tried that?

iNilo commented 4 years ago

amphp/process seems to be more for commands like dig, ping, not specifically calling php scripts that are blocking, unless I fully misunderstood that.

iNilo commented 4 years ago
$promises = [];
for($x = 0; $x <= 10; $x++)
{
    $process = new Process(__DIR__ . "/amp-runner.php");
    $promises[] = $process->start();
    $process->send($x);
}
$all_replies = Promise\wait(Promise\all($promises));
var_dump($all_replies);

errors on

PHP Fatal error:  Uncaught Amp\Parallel\Context\StatusError: The process has not been started in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php:249
Stack trace:
#0 /home/centos/web/public_html/cron/amp-delegator.php(71): Amp\Parallel\Context\Process->send()
#1 {main}
  thrown in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 249
enumag commented 4 years ago

amphp/process is to call anything at all... in fact amphp/parallel is built on top of amphp/process.

enumag commented 4 years ago

Now you're not yielding the promises from send method. Also you can't call send before yielding the promise from start. What didn't you understand about "don't use wait"?

iNilo commented 4 years ago

🥺

Is there any chance you could guide me with (pseudo) code please? I'm not understanding it at all 🤕

1) for loop 20 times. 2) start the php child, send it data. 3) collect the promise (?) 4) wait for my 20 children to come in. (finally) 5) process the results ( 1 DB call to reduce strain on the db )

enumag commented 4 years ago

Ok. Tomorrow. I need to sleep now.

enumag commented 4 years ago

function runProcess($value) {
    return call(
        function () {
            $process = new Process(__DIR__ . "/amp-runner.php");
            yield $process->start();
            yield $process->send($x);
        }
    )
}

Loop::run(
    function () {
        $promises = [];
        for($x = 0; $x <= 10; $x++)
        {
            $promises[] = runProcess($x);
        }
        yield $promises;
    }
);
iNilo commented 4 years ago

Thanks a bunch.

I'm understanding it a bit more, This is my play.php I've setup to test:

<?php
require_once "bootstrap.php";

use Amp\ByteStream;
use Amp\Delayed;
use Amp\Loop;
use Amp\Parallel\Context\Process;
use Amp\Parallel\Worker;
use Amp\Promise;
use function Amp\call;

function runProcess($value)
{
    return call(
        function ()
        {
            global $value;
            $process = new Process(__DIR__ . "/blocking-process.php");
            yield $process->start();
            yield $process->send($value);
        }
    );
}

Loop::run(
    function ()
    {
        $promises = [];
        for($x = 0; $x <= 10; $x++)
        {
            $promises[] = runProcess($x);
        }
        $returns = yield $promises;
        var_dump($returns);
    }
);

this is my blocking-process.php

<?php

// The function returned by this script is run by process.php in a separate process.
// $argc and $argv are available in this process as any other cli PHP script.

use Amp\Parallel\Sync\Channel;

return function (Channel $channel): \Generator {
    $we_are = yield $channel->receive();
    sleep(10);
    yield $channel->send($we_are);
    return $we_are;
};

How would I now get the data from the children?

JanMikes commented 4 years ago

@iNilo check this out: https://github.com/JanMikes/php-async-playground i think it is exactly what you are looking for :-)

kelunik commented 4 years ago

@iNilo I think @JanMikes provided the answer to your question.

@JanMikes https://github.com/amphp/parallel/issues/112#issuecomment-613971464 might be helpful for you if you don't want to write your own protocol using STDOUT for communication, but rather a message based approach, where the library cares about the serialization.

iNilo commented 4 years ago

Thanks for this @JanMikes & @kelunik It helps me a bit further at understanding the dynamics.

I would just love to get to use the frameworks way of sending things back

https://github.com/amphp/parallel/blob/7f00b8effb4fb439176aba0fa392abd120cbd952/examples/blocking-process.php#L14

And grab it from the child as a parent.

https://github.com/amphp/parallel/blob/7f00b8effb4fb439176aba0fa392abd120cbd952/examples/process.php#L31

A possible last request, to understand the framework better;

Is there possibly any chance someone could write another example based on : https://github.com/amphp/parallel/blob/master/examples/process.php

Use the same blocking process, but launch the child 20 times? ❤️ I really want to understand the sending data towards the child, and reading the data form the children.

kelunik commented 4 years ago

@iNilo You already linked the two relevant lines. What do you want to send / receive exactly? One or multiple messages?

iNilo commented 4 years ago

@kelunik thanks, was stuck for a bit, @JanMikes example used \Amp\Process\Process which has no send function, so I swapped it to Amp\Parallel\Context\Process which finally got it working like it should.

@JanMikes possibly check out my code too.

Thanks for the support all of you ❤️ play.php

<?php
require_once "bootstrap.php";

use Amp\ByteStream;
use Amp\Delayed;
use Amp\Loop;
use Amp\Parallel\Context\Process;
use Amp\Parallel\Worker;
use Amp\Promise;
use function Amp\call;

$results = [];
\Amp\Loop::run(static function() use (&$results) {
    $promises = [];
    for($x = 0; $x <= 10; $x++)
    {
        $promises[] = \Amp\call(function() use (&$results, $x): \Generator
        {
            $process = new Amp\Parallel\Context\Process( __DIR__ . "/blocking-process.php");
            yield $process->start();
            yield $process->send($x);
            $results[] = yield $process->receive();
        });
    }
    // Run all promises at once
    yield \Amp\Promise\all($promises);
});
var_dump($results);

blocking-process.php

<?php

// The function returned by this script is run by process.php in a separate process.
// $argc and $argv are available in this process as any other cli PHP script.

use Amp\Parallel\Sync\Channel;

return function (Channel $channel): \Generator
{
    $we_are = yield $channel->receive();
    sleep(10);
    yield $channel->send(" we were runner $we_are , we just slept for 10 seconds ");
    echo $we_are;
    return $we_are;
};

results:

array(11) {
  [0] =>
  string(49) " we were runner 3 , we just slept for 10 seconds "
  [1] =>
  string(49) " we were runner 2 , we just slept for 10 seconds "
  [2] =>
  string(49) " we were runner 1 , we just slept for 10 seconds "
  [3] =>
  string(49) " we were runner 0 , we just slept for 10 seconds "
  [4] =>
  string(49) " we were runner 8 , we just slept for 10 seconds "
  [5] =>
  string(49) " we were runner 5 , we just slept for 10 seconds "
  [6] =>
  string(50) " we were runner 10 , we just slept for 10 seconds "
  [7] =>
  string(49) " we were runner 9 , we just slept for 10 seconds "
  [8] =>
  string(49) " we were runner 7 , we just slept for 10 seconds "
  [9] =>
  string(49) " we were runner 6 , we just slept for 10 seconds "
  [10] =>
  string(49) " we were runner 4 , we just slept for 10 seconds "
}
JanMikes commented 4 years ago

@iNilo looks good to me

@JanMikes #112 (comment) might be helpful for you if you don't want to write your own protocol using STDOUT for communication, but rather a message based approach, where the library cares about the serialization

Process i want to run is symfony/console command that knows nothing about amphp but is capable of writing json results to stdout, thats why i went this way. How would that process receive without amphp data from $process->send($x)? Actually i dont need to send any data to the child process, just run it with correct arguments. What i need is the child to be able to return data to parent (which i thought stdout/stderr is completely fine).

I tried it here: https://github.com/JanMikes/php-async-playground/blob/parallel-context/script.php

If i understand it correctly, if i want to use channel/context to parent-child communication i need that process to be a php script which returns \Generator?

I am sure it could be done other the "amp way", instead of runnng directly symfony/console directly via new Process(['bin/console', 'xx']) i could create child process script with something like this:

<?php

return function(Channel $channel) {
    $container = createSymfonyContainer(); // magic behind ...
    $application = $container->get(Application::class);

    $code = $application->run();

    $service = $container->get(MyService::class);

    yield $channel->send($service->getResults());

    return $code;
};

I dont fully understand what are all added values using channel to communicate instead of taking it directly from stdout and if my thinking is correct, though i like that i dont have to care about serialization/deserialization and just send data to channel.

iNilo commented 4 years ago

Whilst slightly offtopic: The second I bump that for loop to 50 times I'm greeted by

PHP Fatal error:  Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:253
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(29): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:127
Stack trace:
#0 [internal function]: Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php(1 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Was this the reason a delay was introduced in the examples?

kelunik commented 4 years ago

@iNilo Do you have error reporting enabled? Does PHP emit any notices / warnings?

iNilo commented 4 years ago

With xdebug on @kelunik play.php

<?php
require_once "../bootstrap.php";

error_reporting(E_ALL);
ini_set('display_errors', 1);

use Amp\ByteStream;
use Amp\Delayed;
use Amp\Loop;
use Amp\Parallel\Context\Process;
use Amp\Parallel\Worker;
use Amp\Promise;
use function Amp\call;

$results = [];
$endings = [];
\Amp\Loop::run(static function() use (&$results, &$endings) {
    $promises = [];
    for($x = 0; $x <= 50; $x++)
    {
        $promises[] = \Amp\call(function() use (&$results, &$endings, $x): \Generator
        {
            $process = new Amp\Parallel\Context\Process( __DIR__ . "/blocking-process.php");
            yield $process->start();
            yield $process->send($x);
            $results[] = yield $process->receive();
            $endings[] = yield $process->join();
        });
    }
    // Run all promises at once
    yield \Amp\Promise\all($promises);
});
d($results);
d($endings);

php play.php

PHP Fatal error:  Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:253
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:127
Stack trace:
#0 [internal function]: Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php(1 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Fatal error: Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:253
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Amp\Parallel\Context\ContextException: Starting the process failed in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Call Stack:
    0.0002     396144   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0091    1433664   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:32
    0.0093    1444720   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.5128    3468128   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.5128    3461208   5. Amp\Loop\NativeDriver->error() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:133
kelunik commented 4 years ago

If you add yield Amp\delay(0) before line 123 in ProcessHub.php, does that help? If not, how high does the timeout have to be to get it working and no longer time out?

iNilo commented 4 years ago

@kelunik is there any chance I can do this in my play.php ? or do I have to edit the file in my /vendor/ map ?

kelunik commented 4 years ago

You'll need to edit the file in vendor or clone this repository and run your play.php like one of the examples in this repository.

iNilo commented 4 years ago

Understood @kelunik

So I add yield Amp\delay(0) before or after this line? (on my end)

https://github.com/amphp/parallel/blob/2b418eb71d6e82ced042e6bbadb8f81db185a6c5/lib/Context/Internal/ProcessHub.php#L122

Also, is this an issue on my end? (host) or library?

iNilo commented 4 years ago

Editing my play.php did not help :(

require_once "../bootstrap.php";

error_reporting(E_ALL);
ini_set('display_errors', 1);

use Amp\ByteStream;
use Amp\Delayed;
use Amp\Loop;
use Amp\Parallel\Context\Process;
use Amp\Parallel\Worker;
use Amp\Promise;
use function Amp\call;

$results = [];
$endings = [];
\Amp\Loop::run(static function() use (&$results, &$endings) {
    $promises = [];
    for($x = 0; $x <= 50; $x++)
    {
        $promises[] = \Amp\call(function() use (&$results, &$endings, $x): \Generator
        {
            yield Amp\delay(2500);
            $process = new Amp\Parallel\Context\Process( __DIR__ . "/blocking-process.php");
            yield Amp\delay(2500);
            yield $process->start();
            yield Amp\delay(2500);
            yield $process->send($x);
            yield Amp\delay(2500);
            $results[] = yield $process->receive();
            $endings[] = yield $process->join();
        });
    }
    // Run all promises at once
    yield Amp\delay(2500);
    yield \Amp\Promise\all($promises);
});
d($results);
d($endings);
php play.php
PHP Fatal error:  Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:253
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(37): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:127
Stack trace:
#0 [internal function]: Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php(1 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Fatal error: Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:253
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(37): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Amp\Parallel\Context\ContextException: Starting the process failed in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Call Stack:
    0.0002     397784   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0093    1435304   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
    0.0095    1446360   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
   11.4283    3379664   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
kelunik commented 4 years ago

Yes, right before the linked line. I'm not sure what's causing the issue, I can't currently reproduce it the same way you're experiencing it.

iNilo commented 4 years ago

@kelunik

When adding a delay at the requested line:

https://github.com/amphp/parallel/blob/2b418eb71d6e82ced042e6bbadb8f81db185a6c5/lib/Context/Internal/ProcessHub.php#L122

So it looks like:

            try {
        yield delay(150);
                $channel = yield Promise\timeout($this->acceptor[$pid]->promise(), self::PROCESS_START_TIMEOUT);

            } 

php play.php

PHP Notice:  Undefined offset: 4414 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124
PHP Stack trace:
PHP   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
PHP   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
PHP   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
PHP   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
PHP   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
PHP   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
PHP   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
PHP   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
PHP   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
PHP  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

Notice: Undefined offset: 4414 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124

Call Stack:
    0.0002     397752   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0090    1435272   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
    0.0092    1446328   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.3709    3388192   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.6292    3376320   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
    6.6302    3397888   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
    6.6302    3397888   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
    6.6302    3397888   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
    6.6302    3397984   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
    6.6302    3397984  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

PHP Notice:  Undefined offset: 4415 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124
PHP Stack trace:
PHP   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
PHP   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
PHP   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
PHP   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
PHP   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
PHP   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
PHP   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
PHP   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
PHP   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
PHP  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

Notice: Undefined offset: 4415 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124

Call Stack:
    0.0002     397752   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0090    1435272   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
    0.0092    1446328   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.3709    3388192   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.6292    3376320   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
    6.6488    3431848   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
    6.6488    3431848   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
    6.6489    3431848   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
    6.6489    3431944   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
    6.6489    3431944  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

PHP Notice:  Undefined offset: 4412 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124
PHP Stack trace:
PHP   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
PHP   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
PHP   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
PHP   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
PHP   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
PHP   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
PHP   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
PHP   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
PHP   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
PHP  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

Notice: Undefined offset: 4412 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124

Call Stack:
    0.0002     397752   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0090    1435272   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
    0.0092    1446328   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.3709    3388192   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.6292    3376320   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
    6.6741    3405776   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
    6.6741    3405776   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
    6.6742    3405776   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
    6.6742    3405872   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
    6.6742    3405872  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

PHP Notice:  Undefined offset: 4409 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124
PHP Stack trace:
PHP   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
PHP   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
PHP   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
PHP   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
PHP   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
PHP   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
PHP   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
PHP   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
PHP   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
PHP  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

Notice: Undefined offset: 4409 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124

Call Stack:
    0.0002     397752   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0090    1435272   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
    0.0092    1446328   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.3709    3388192   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.6292    3376320   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
    6.6746    3379064   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
    6.6746    3379064   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
    6.6747    3379064   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
    6.6747    3379160   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
    6.6747    3379160  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

PHP Notice:  Undefined offset: 4408 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124
PHP Stack trace:
PHP   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
PHP   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
PHP   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
PHP   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
PHP   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
PHP   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
PHP   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
PHP   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
PHP   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
PHP  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

Notice: Undefined offset: 4408 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124

Call Stack:
    0.0002     397752   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0090    1435272   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
    0.0092    1446328   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.3709    3388192   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.6292    3376320   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
    6.6856    3352384   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
    6.6856    3352384   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
    6.6856    3352384   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
    6.6856    3352480   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
    6.6856    3352480  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

PHP Notice:  Undefined offset: 4413 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124
PHP Stack trace:
PHP   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
PHP   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
PHP   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
PHP   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
PHP   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
PHP   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
PHP   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
PHP   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
PHP   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
PHP  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

Notice: Undefined offset: 4413 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124

Call Stack:
    0.0002     397752   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0090    1435272   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
    0.0092    1446328   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.3709    3388192   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.6292    3376320   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
    6.6861    3325736   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
    6.6861    3325736   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
    6.6861    3325736   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
    6.6861    3325832   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
    6.6861    3325832  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

PHP Notice:  Undefined offset: 4411 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124
PHP Stack trace:
PHP   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
PHP   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
PHP   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
PHP   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
PHP   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
PHP   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
PHP   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
PHP   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
PHP   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
PHP  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

Notice: Undefined offset: 4411 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124

Call Stack:
    0.0002     397752   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0090    1435272   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
    0.0092    1446328   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.3709    3388192   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.6292    3376320   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
    6.6867    3299120   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
    6.6867    3299120   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
    6.6867    3299120   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
    6.6867    3299216   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
    6.6867    3299216  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

PHP Notice:  Undefined offset: 4410 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124
PHP Stack trace:
PHP   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
PHP   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
PHP   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
PHP   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
PHP   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
PHP   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
PHP   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
PHP   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
PHP   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
PHP  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

Notice: Undefined offset: 4410 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php on line 124

Call Stack:
    0.0002     397752   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0090    1435272   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
    0.0092    1446328   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.3709    3388192   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.6292    3376320   5. Amp\Loop\NativeDriver->dispatch() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:138
    6.6871    3272552   6. Amp\Delayed->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:24-26}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php:122
    6.6871    3272552   7. Amp\Delayed->resolve() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php:25
    6.6871    3272552   8. Amp\Coroutine->Amp\{closure:/home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:91-148}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php:149
    6.6871    3272648   9. Generator->send() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118
    6.6871    3272648  10. Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure:/home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:117-138}() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php:118

PHP Fatal error:  Uncaught Error: Call to a member function promise() on null in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:124
Stack trace:
#0 [internal function]: Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php(118): Generator->send()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Internal/Placeholder.php(149): Amp\Coroutine->Amp\{closure}()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Delayed.php(25): Amp\Delayed->resolve()
#4 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Delayed->Amp\{closure}()
#5 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#6 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#7 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#8  in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Fatal error: Uncaught Error: Call to a member function promise() on null in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Amp\Parallel\Context\ContextException: Starting the process failed in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Call Stack:
    0.0002     397752   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0090    1435272   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:37
    0.0092    1446328   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.6984    3245096   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.6989    3229288   5. Amp\Loop\NativeDriver->error() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:133
iNilo commented 4 years ago

Spun up a new lightsail image

image

Executed installs of bare minimum:

sudo yum install dnf -y
sudo dnf update -y
sudo dnf upgrade -y
sudo dnf install wget -y
sudo dnf install epel-release -y
sudo dnf install htop -y
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum -y install yum-utils
sudo yum-config-manager --enable remi-php74
sudo dnf install -y php php-cli php-xdebug openssl php-common php-curl php-json php-mbstring php-mysql php-xml php-zip php-process
PHP 7.4.4 (cli) (built: Mar 17 2020 10:40:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Xdebug v2.9.4, Copyright (c) 2002-2020, by Derick Rethans

Uploaded play.php

PHP Fatal error:  Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:253
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:127
Stack trace:
#0 [internal function]: Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php(1 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Fatal error: Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:253
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Amp\Parallel\Context\ContextException: Starting the process failed in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Call Stack:
    0.0002     397928   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0120    1121792   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:32
    0.0131    1132848   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.1019    1727664   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.1019    1720744   5. Amp\Loop\NativeDriver->error() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:133

So its not my specific instance, but its reproducible new ones too.

iNilo commented 4 years ago

Launched a debian 9.5 image

image

sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install wget -y
sudo apt -y install lsb-release apt-transport-https ca-certificates wget
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update
sudo apt-get install -y php php-cli php-xdebug openssl php-common php-curl php-json php-mbstring php-mysql php-xml php-zip
PHP 7.4.4 (cli) (built: Mar 20 2020 14:24:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.4, Copyright (c), by Zend Technologies
    with Xdebug v2.9.3, Copyright (c) 2002-2020, by Derick Rethans

php play.php

PHP Fatal error:  Uncaught Amp\TimeoutException: Operation timed out in /home/admin/web/public_html/cron/vendor/amphp/amp/lib/functions.php:253
Stack trace:
#0 /home/admin/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/admin/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/admin/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/admin/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/admin/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/admin/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:127
Stack trace:
#0 [internal function]: Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure}()
#1 /home/admin/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php(115): Gen in /home/admin/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Fatal error: Uncaught Amp\TimeoutException: Operation timed out in /home/admin/web/public_html/cron/vendor/amphp/amp/lib/functions.php:253
Stack trace:
#0 /home/admin/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/admin/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/admin/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/admin/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/admin/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/admin/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Amp\Parallel\Context\ContextException: Starting the process failed in /home/admin/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Call Stack:
    0.0002     396048   1. {main}() /home/admin/web/public_html/cron/working_example/play.php:0
    0.0072    1120080   2. Amp\Loop::run() /home/admin/web/public_html/cron/working_example/play.php:32
    0.0074    1131136   3. Amp\Loop\NativeDriver->run() /home/admin/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.1567    1737888   4. Amp\Loop\NativeDriver->tick() /home/admin/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.1567    1730968   5. Amp\Loop\NativeDriver->error() /home/admin/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:133
iNilo commented 4 years ago

So it is replicable if you want @kelunik

Its not OS dependent from the looks of it.

trowski commented 4 years ago

@iNilo Can you please try with "amphp/parallel": "dev-issue-112 as 1.4" as the requirement in your composer.json and let me know if that changes anything.

iNilo commented 4 years ago

@trowski I can reach 45 processes now.

(Ideally I would like to hit 250 🚀 🤞 )

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 2 updates, 0 removals
  - Updating amphp/amp (v2.4.2 => v2.4.3): Downloading (100%)
  - Installing amphp/serialization (v1.0.0): Loading from cache
  - Removing amphp/parallel (v1.3.0)
  - Installing amphp/parallel (dev-issue-112 5345eb5): Cloning 5345eb5600
Writing lock file
Generating autoload files

25 Works. 30 Works. 35 Works. 40 Works. 45 Works. 50 Errors.

<?php
chdir(__DIR__);
require_once '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

error_reporting(E_ALL);
ini_set('display_errors', 1);

use Amp\ByteStream;
use Amp\Delayed;
use Amp\Loop;
use Amp\Parallel\Context\Process;
use Amp\Parallel\Worker;
use Amp\Promise;
use function Amp\call;

$results = [];
$endings = [];
\Amp\Loop::run(static function() use (&$results, &$endings) {
    $promises = [];
    for($x = 0; $x <= 50; $x++)
    {
        $promises[] = \Amp\call(function() use (&$results, &$endings, $x): \Generator
        {
            $process = new Amp\Parallel\Context\Process( __DIR__ . "/blocking-process.php");
            yield $process->start();
            yield $process->send($x);
            $results[] = yield $process->receive();
            $endings[] = yield $process->join();
        });
    }
    yield \Amp\Promise\all($promises);
});
d($results);
d($endings);

php play.php


PHP Fatal error:  Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:270
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:127
Stack trace:
#0 [internal function]: Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php(1 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Fatal error: Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:270
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Amp\Parallel\Context\ContextException: Starting the process failed in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Call Stack:
    0.0003     396504   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0068    1125208   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:32
    0.0070    1136264   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.9224    2940464   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.9225    2933544   5. Amp\Loop\NativeDriver->error() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:133
trowski commented 4 years ago

Please modify this line to change the delay between launching processes. Try various values such as 200, 500, and 1000. The process launching will be much slower, but I'm curious to find out what changes.

bergmab commented 4 years ago

I am also having the same issue as iNilo and did try the "dev-issue-112 as 1.4" version and played with the delay. What I remarked is, as soon as I increase the worker pool size to more than 32, it delays the failure at a later time instead of failing relatively quickly like before. So for me it does not fix the issue. The only thing I observed is the worker is now crashing:

  16 => Amp\Parallel\Context\ContextException^ {#597255
    #message: "Starting the process failed"
    #code: 0
    #file: "./vendor/amphp/parallel/lib/Context/Process.php"
    #line: 202
    -previous: Amp\Parallel\Context\ContextException^ {#596817 …6}    #line: 118
    trace: { …228}
  }
  1681 => Amp\Parallel\Worker\WorkerException^ {#428541
    #message: "The worker crashed"
    #code: 0
    #file: "./vendor/amphp/parallel/lib/Worker/TaskWorker.php"
    #line: 118
    trace: { …228}
  }
kelunik commented 4 years ago

@bergmab @iNilo What does ulimit -a output for you?

iNilo commented 4 years ago

@kelunik

ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 1754
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1754
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

FYI: I've played with max files, but did not change anything at all. You get specific errors if you hit max open file limit " TOO MANY OPEN FILES " or related.

@trowski any chance to change this in runtime? (possible feature request?) https://github.com/amphp/parallel/commit/5345eb56005e6024d0bae78080fc64f922943829#diff-e5cc7987b80e7ad759e6ffa45159382aR122

\Amp\Parallel\Worker::setLaunchDelay(1000); or similar?

    protected static $delay= 100;
    public static function setLaunchDelay($delay) {
        self::$delay= $delay;
    }
    self::$throttle = new Delayed(self::$delay);
bergmab commented 4 years ago

Note that I manually updated open files to 4096. System defaults are 1024.

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31191
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 4096
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31191
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
kelunik commented 4 years ago

Could you try with the issue-112-kelunik branch instead?

iNilo commented 4 years ago

@kelunik , @trowski

Delays from 150 to 5500 keep erroring. dev-issue-112

php play.php
PHP Fatal error:  Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:270
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:127
Stack trace:
#0 [internal function]: Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php(1 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Fatal error: Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:270
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Amp\Parallel\Context\ContextException: Starting the process failed in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Call Stack:
    0.0006     396504   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0178    1125208   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:32
    0.0184    1136264   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.1089    1748680   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.1089    1741760   5. Amp\Loop\NativeDriver->error() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:133
iNilo commented 4 years ago

@kelunik issue-112-kelunik

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 1 removal
  - Removing amphp/serialization (v1.0.0)
  - Updating amphp/parallel (dev-issue-112 5345eb5 => dev-issue-112-kelunik d0ade9f):     The package has modified files:
    M lib/Worker/TaskWorker.php
    Discard changes [y,n,v,d,s,?]?
    y - discard changes and apply the update
    n - abort the update and let you manually clean things up
    v - view modified files
    d - view local modifications (diff)
    s - stash changes and try to reapply them after the update
    ? - print help
    Discard changes [y,n,v,d,s,?]? y
 Checking out d0ade9f5e9
Writing lock file
Generating autoload files
PHP Fatal error:  Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:270
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:130
Stack trace:
#0 [internal function]: Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php(1 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Fatal error: Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:270
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Amp\Parallel\Context\ContextException: Starting the process failed in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Call Stack:
    0.0007     396504   1. {main}() /home/centos/web/public_html/cron/working_example/play.php:0
    0.0072    1121888   2. Amp\Loop::run() /home/centos/web/public_html/cron/working_example/play.php:32
    0.0074    1132944   3. Amp\Loop\NativeDriver->run() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php:95
    6.4525    1738488   4. Amp\Loop\NativeDriver->tick() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:72
    6.4525    1731568   5. Amp\Loop\NativeDriver->error() /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php:133
iNilo commented 4 years ago

btw, I can give you ssh access to my lightsail vm if you want, if that would help anything?

kelunik commented 4 years ago

I should be able to reproduce it locally, but I'm currently not. Do you have xdebug enabled?

iNilo commented 4 years ago

@kelunik php -i

I think so:

his program makes use of the Zend Scripting Language Engine:
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Xdebug v2.9.4, Copyright (c) 2002-2020, by Derick Rethans

xdebug

xdebug support => enabled
Version => 2.9.4
Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support

Debugger => enabled
IDE Key => centos

Directive => Local Value => Master Value
xdebug.auto_trace => Off => Off
xdebug.cli_color => 0 => 0
xdebug.collect_assignments => Off => Off
xdebug.collect_includes => On => On
xdebug.collect_params => 0 => 0
xdebug.collect_return => Off => Off
xdebug.collect_vars => Off => Off
xdebug.coverage_enable => On => On
xdebug.default_enable => On => On
xdebug.dump.COOKIE => no value => no value
xdebug.dump.ENV => no value => no value
xdebug.dump.FILES => no value => no value
xdebug.dump.GET => no value => no value
xdebug.dump.POST => no value => no value
xdebug.dump.REQUEST => no value => no value
xdebug.dump.SERVER => no value => no value
xdebug.dump.SESSION => no value => no value
xdebug.dump_globals => On => On
xdebug.dump_once => On => On
xdebug.dump_undefined => Off => Off
xdebug.file_link_format => no value => no value
xdebug.filename_format => no value => no value
xdebug.force_display_errors => Off => Off
xdebug.force_error_reporting => 0 => 0
xdebug.gc_stats_enable => Off => Off
xdebug.gc_stats_output_dir => /tmp => /tmp
xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p
xdebug.halt_level => 0 => 0
xdebug.idekey => no value => no value
xdebug.max_nesting_level => 256 => 256
xdebug.max_stack_frames => -1 => -1
xdebug.overload_var_dump => 2 => 2
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_enable_trigger_value => no value => no value
xdebug.profiler_output_dir => /tmp => /tmp
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_addr_header => no value => no value
xdebug.remote_autostart => Off => Off
xdebug.remote_connect_back => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => Off => Off
xdebug.remote_host => localhost => localhost
xdebug.remote_log => no value => no value
xdebug.remote_log_level => 7 => 7
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.remote_timeout => 200 => 200
xdebug.scream => Off => Off
xdebug.show_error_trace => Off => Off
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => Off => Off
xdebug.show_mem_delta => Off => Off
xdebug.trace_enable_trigger => Off => Off
xdebug.trace_enable_trigger_value => no value => no value
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => /tmp => /tmp
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.var_display_max_children => 128 => 128
xdebug.var_display_max_data => 512 => 512
xdebug.var_display_max_depth => 3 => 3
kelunik commented 4 years ago

How do things change if you disable xdebug? I can reproduce errors in case xdebug is enabled, but not the timeouts you see.

bergmab commented 4 years ago

On my side xdebug is not enabled and I am still getting those errors with branch issue-112-kelunik:

 7 => Amp\Parallel\Context\ContextException^ {#419028
    #message: "Starting the process failed"
    #code: 0
    #file: "./vendor/amphp/parallel/lib/Context/Process.php"
    #line: 202
    -previous: Amp\Parallel\Context\ContextException^ {#415499
      #message: "Starting the process timed out"
      #code: 0
      #file: "./vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php"
      #line: 127
      -previous: Amp\TimeoutException^ {#418354 …5}
      trace: { …31}
    }
iNilo commented 4 years ago

@kelunik me butchering xdebug.

php play.php

PHP Warning:  Failed loading Zend extension 'xdebug.so' (tried: /usr/lib64/php/modules/xdebug.so (/usr/lib64/php/modules/xdebug.so: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/xdebug.so.so (/usr/lib64/php/modules/xdebug.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Fatal error:  Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:270
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:130
Stack trace:
#0 [internal function]: Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php(1 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202

Fatal error: Uncaught Amp\TimeoutException: Operation timed out in /home/centos/web/public_html/cron/vendor/amphp/amp/lib/functions.php:270
Stack trace:
#0 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/NativeDriver.php(122): Amp\Promise\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#2 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#3 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#4 /home/centos/web/public_html/cron/working_example/play.php(32): Amp\Loop::run()
#5 {main}

Next Amp\Parallel\Context\ContextException: Starting the process timed out in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Internal/ProcessHub.php:130
Stack trace:
#0 [internal function]: Amp\Parallel\Context\Internal\ProcessHub->Amp\Parallel\Context\Internal\{closure}()
#1 /home/centos/web/public_html/cron/vendor/amphp/amp/lib/Coroutine.php(1 in /home/centos/web/public_html/cron/vendor/amphp/parallel/lib/Context/Process.php on line 202
bergmab commented 4 years ago

@kelunik do you test with a build of PHP with ZTS (Zend Thread Safety) enabled? On my side it's not.

PHP 7.4.5 (cli) (built: Apr 14 2020 12:54:33) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
bergmab commented 4 years ago

@kelunik @trowski When ZTS & krakjoe/parallel is installed does amphp/parallel automatically uses it instead of processes? If yes, does the tests you are doing on your side are are with ZTS & krakjoe/parallel? If yes, can it explains why you cannot reproduce the issue? Just brainstorming here...

@iNilo did you try with ZTS & krakjoe/parallel installed?

kelunik commented 4 years ago

@bergmab I can reproduce it with php examples/4-closure.php 100 100 now after fixing another bug.