Segmentation fault (core dumped) when executing a cakephp command with php parallel

46 Views Asked by At

I'm trying to use cakephp command with php/parallel but getting a "Segmentation fault (core dumped)" error message. It's a simple new controller object that loads a component and i try to execute a function from this component. If i just, for test, return the parameters that the function receive, it works fine, so i'm excluding any error from php/parallel. This is my code:

public function hashParalel()
    {
        $numeros_letras = [
            ['00000000000000000001' => 'ABCD'],
            ['00000000000000000002' => 'EFGH'],
            ['00000000000000000003' => 'IJKL'],
            ['00000000000000000004' => 'MNOP'],
            ['00000000000000000005' => 'QRST'],
            ['00000000000000000006' => 'UVWX'],
            ['00000000000000000007' => 'YZAB'],
            ['00000000000000000008' => 'CDEF'],
        ];

        $hashes_online = [];
        $runtimes = [];
        $futures = [];

        foreach ($numeros_letras as $i => $numero_letra_arr) {
            foreach ($numero_letra_arr as $numero => $letra) {
                $runtimes[$i] = new Runtime('/var/www/html/myproject/vendor/autoload.php');

                $futures[$i] = $runtimes[$i]->run(function ($numero, $sigla) {
                    $controller = new \App\Controller\ONEController();

                    $controller->loadComponent('CMPNT');

                    $result = $controller->CMPNT->retorna($numero, $sigla);

                    return $result;

                }, [$numero, $letra]);
            }
        }

        foreach ($futures as $future) {
            $hashes_online[] = $future->value();
        }

        debug($hashes_online);

        exit;
    }

And then when i execute from cli all a get is "Segmentation fault (core dumped)" and the script stops.

0

There are 0 best solutions below