Skip to content

The context stopped responding, potentially due to a fatal error or calling exit #109

@parsibox

Description

@parsibox

hi i get error at end of consept return
i use php82 on centos 7 64 bit

error:

Sleeping for 3 seconds...
13:54:18 :  ssss
13:54:19 :  ssss
13:54:20 :  ssss
13:54:21 : Child 68061cd1d3ecd status: Data sent from child.
Sleeping for 2 seconds...
13:54:21 :  ssss
13:54:22 :  ssss
13:54:23 : 68061cd1d3ecd Failed to start process The context stopped responding, potentially due to a fatal error or calling exit#0 /var/www/html/cron/Amphp/send.php(86): Amp\Parallel\Context\Internal\AbstractContext->receive()
#1 /var/www/html/php8/vendor/amphp/amp/src/functions.php(33): {closure}()
#2 /var/www/html/php8/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(430): Amp\{closure}()
#3 /var/www/html/php8/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(567): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()
#4 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#5 /var/www/html/php8/vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php(64): Fiber->resume()
#6 /var/www/html/php8/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(430): Revolt\EventLoop\Internal\DriverSuspension::Revolt\EventLoop\Internal\{closure}()
#7 /var/www/html/php8/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(621): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()
#8 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#9 /var/www/html/php8/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(502): Fiber->resume()
#10 /var/www/html/php8/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(558): Revolt\EventLoop\Internal\AbstractDriver->invokeCallbacks()
#11 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#12 /var/www/html/php8/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(96): Fiber->start()
#13 /var/www/html/php8/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(116): Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#14 /var/www/html/php8/vendor/revolt/event-loop/src/EventLoop.php(406): Revolt\EventLoop\Internal\AbstractDriver->run()
#15 /var/www/html/cron/Amphp/send.php(108): Revolt\EventLoop::run()
#16 {main}
sh: line 1: 90490 Killed                  ( '/opt/remi/php82/root/usr/bin/php' '-dhtml_errors=0' '-ddisplay_errors=0' '-dlog_errors=1' '/var/www/html/php8/vendor/amphp/parallel/src/Context/Internal/process-runner.php' 'unix:///tmp/amp-parallel-ipc-349827f13e06dcb4505b.sock' '64' '5' '/var/www/html/cron/Amphp/child/sms_send_select.php' ) 0<&3 3>&- 3> /dev/null

 php82 -v
PHP 8.2.20 (cli) (built: Jun  4 2024 13:22:51) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.2.20, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.20, Copyright (c), by Zend Technologies

<?php

ignore_user_abort(true);
@set_time_limit(0);
error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('memory_limit', '-1');
@session_write_close();
gc_enable();

define('base_dir_include', '../../');


require base_dir_include . 'php8/vendor/autoload.php';


use Revolt\EventLoop;
use function Amp\async;
use function Amp\Future\await;
use Amp\Process\Process;
use function Amp\delay;


function PrintLog($obj)
{
    if (is_string($obj)) {
        print date('H:i:s') . ' : ' . $obj . PHP_EOL;
    } else {
        print date('H:i:s') . ' : ' . var_export($obj, true) . PHP_EOL;
    }
}
$my_operator=11;
$number_send_info = 12
$number_send_info['provider']='mci';
$halghe_i=0;
$my_note_arr[0]=array('سلام');
$my_sender_number_arr[0]=array('1040');
$my_number_arr[0]=array('+989111677411');
$my_flash_arr[0]=array(0);
$my_id_arr[0]=array(1);
$sumOfLong=1;
$pm_pid = uniqid();
$args = array(
    'pm_pid' => $pm_pid
, 'my_note_arr' => $my_note_arr[$halghe_i]
, 'my_sender_number_arr' => $my_sender_number_arr[$halghe_i]
, 'my_number_arr' => $my_number_arr[$halghe_i]
, 'number_send_info' => $number_send_info
, 'my_flash_arr' => $my_flash_arr[$halghe_i]
, 'my_id_arr' => $my_id_arr[$halghe_i]
, 'sumOfLong' => $sumOfLong
    // , 'my_long_arr' => $my_long_arr[$halghe_i]

);

++$halghe_i;
EventLoop::repeat(1, function () use ($atomicRate) {
    PrintLog(' ssss');
});
$fu=Amp\async(function () use ($args , $pm_pid) {
    try {
        PrintLog('add ' . $pm_pid);

        //  $contextFactory = new Amp\Parallel\Context\ProcessContextFactory();
        //   $context = $contextFactory->start(__DIR__ . '/../child/sms_send_select.php');


       $context = Amp\Parallel\Context\contextFactory()->start(__DIR__ . '/child/sms_send_select.php');
        $context->send($args);

        while (!$context->isClosed()) {
            $message = $context->receive(); // Receive message from child
            PrintLog("Child " . $pm_pid . " status: {$message}");

            if ($message == 'finished') {
                break;
            } elseif ($message == 'updating_db') {
                break;
            }
        }

        $returnValue = $context->join();
        PrintLog($pm_pid . " processes exited with " . $returnValue);
        unset($context);

    } catch (Amp\Parallel\Context\ContextException $e) {
        
        PrintLog($pm_pid . " Failed to start process " . $e->getMessage(). $e->getTraceAsString());
    }
});

PrintLog("before run loop");
try{
    Revolt\EventLoop::run();
} catch (Throwable $e) {
    PrintLog("Unhandled exception in EventLoop: " . $e->getMessage());
    PrintLog("File: " . $e->getFile() . ' on line ' . $e->getLine());
    PrintLog("Trace: " . $e->getTraceAsString());
}

?>

sms_send_select.php:

<?php

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

use Amp\Sync\Channel;

return function (Channel $channel): int {
    printf("Received the following from parent: %s\n", var_export($channel->receive() , true ));

    print "Sleeping for 3 seconds...\n";
    sleep(3); // Blocking call in process.

    $channel->send("Data sent from child.");

    print "Sleeping for 2 seconds...\n";
    sleep(2); // Blocking call in process.
    
    return 42;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions