PHP-FPM Error - keep getting ???Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 107374182448 bytes) in ???

the product environment ,all requrest return error:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 107374182448 bytes) in /www/wwwroot/xxx/framework/bootstrap.inc.php on line 108

then set memory_limit to -1

ini_set('memory_limit',-1);

return

Fatal error: Out of memory (allocated 2097152) (tried to allocate 107374182448 bytes) in...

when I restart php-fpm service ,It was OK ,but it will happen again after a while.

My PHP version is PHP 7.3 ,open Opcache.

Answer

Solution:

setting pm = ondemand in php-fpm.conf may solve the problem.

Source