Solving a runaway memory process (php7-fpm process of 14GB+)
I have memory_limit set to "128M" confirmed by phpinfo(), and max_execution_time set to 300 seconds. Somehow something is ignoring both of these causing 14GB+ memory usage in a single php-fpm child, by which time the server is no longer responding and has to be killed. Of course, since fpm is killed, it cannot log the offending request since it never finished. All of the other children are normal-sized so I am fairly sure this is caused by a single request and not a lot of large ones or a memory leak over time.
Questions to get to the bottom of this or stop it from bringing everything to a halt:
- Is there a way to get the fpm master process to reserve a slot for the php-status page so I can get the list of currently running requests and see what this pid is doing? Failing that, is there ANY other way to get fpm to tell me what the heck is going on right now?
- Is there a way to get the fpm master process to enforce a maximum size on a child from outside? I'm guessing something in libxml or another module that ignores
memory_limitis going haywire. If it kills the process when it hits say 4GB it would be nice if it could either log the offending request or at least something to let me know when it happened so that I can look for the broken connection in the apache log. - Anyone know any monitoring tools that can watch for oversized processes and react on its own to solve the problem (eg wget localhost/php-status?full then restart)?
4 comments · 100% upvoted · other discussions
Is this script being called by a cron script or executing with php-cli?