1

I am running a CodeIgniter App on top of Nginx and PHP-FPM .

PHP was manually compiled with ZTS and Pthreads support

I am trying to run the pending tasks from the App with a cron (php spark task:run tasks) in CLI and getting this error every time :

Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 3347974853963771560 bytes) in /home/nginx/domains/mydomain.com/app/Commands/Task.php on line 62

Here is the code related to the error :

require APPPATH . 'Vendor/autoload.php';
    $UserId = $Task->task_destination;
    $ClientSettings = [
        'base_uri'  =>  'https://www.example.com',
        'cookies'   =>  $cookie_jar = new FileCookieJar(

LINE 62! APPPATH . 'Vendor/abc/app-php/sessions/' . $Account->account_username . '/' . $Account->account_username . '-cookies.dat',
            false
        )
    ];

There seems to be some memory leaking issues related to pthreads as the tasks are using its multithreading.

Things I have tried so far to fix the issue :

1) I set a memory limit of 2GB RAM in PHP CLI .ini file

2) I have tried forcing the memory size by running php -d memory_limit=2048M before the spark command

3) I have tried to change the memory directly in Codeigniter

It's getting really frustrating and at this point I don't even know if this is a code issue or a server side issue , does anyone have a clue on what might be wrong ? Thanks

  • do any of those answers help? https://stackoverflow.com/questions/415801/allowed-memory-size-of-33554432-bytes-exhausted-tried-to-allocate-43148176-byte – Vickel Jun 09 '20 at 22:35
  • @Vickel not really, tried all of those (setting unlimited memory and specific memory limit) and they seem to be mostly for cases where the memory is exhausted due to low limits . In my case there seems to be a memory leak as it tries to allocate 3347974853963771560 bytes , which is a ridiculous amount of memory ... – Optimus Servers Jun 09 '20 at 22:53

0 Answers0