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