Nginx – php-fpm invokes oom-killer

nginxoomphp-fpm

I'm seeing an issue where PHP-FPM works perfectly for a few days, and then decides to fill up all the memory + swap and invoke OOM-Killer. After this happens, the server is completely dead and you can't even SSH into it anymore. A hard restart has to happen to bring things back to normal.

I'm wondering why this is happening and if there's either a fix or a workaround, such as limiting the amount of memory it can use or restarting the process if it's starts using too much.

I've captured the kernel dumps the last few times its happened.

  1. http://pastebin.com/raw.php?i=rX6jYDe0
  2. http://pastebin.com/raw.php?i=f2qx5GcS

My php-fpm.conf

  1. http://pastebin.com/raw.php?i=27hvN27q

My www.conf:

  1. http://pastebin.com/raw.php?i=VgYtut9j

Let me know if there's anything else I can give you for more information on why this could be happening.

Best Answer

Try to reduce pm.max_requests to some lower values (1000). Also, you have high pm.start_servers, pm.start_servers, pm.max_spare_servers values and extremely high pm.max_children