1

Yesterday I performed a release upgrade which included the upgrade from PHP 7.4 to 8.2.

At first, I thought that the problem could come from the PHP version (because was php8.2-fpm the service that kept dying), so I reverted back to php7.4-fpm, but this didn't solve the problem.

php7.4-fpm.service: A process of this unit has been killed by the OOM killer.
php7.4-fpm.service: Failed with result 'oom-kill'.
php7.4-fpm.service: Consumed 12min 18.367s CPU time.

I have site's sockets organized by pools

All have this config:

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

Service drops in around 1 hour. So I decided to introduce a max_requests limitation

pm.max_requests = 1000

And then it went much more stable, but ended dropping in around 12 hours. So now I fear that just tweaking this and keeping reducing this number, will only make the server drop simply later but drop at some point, which is not ideal. The weird part here is that before the update (Ubuntu 20.04 LTS) it was 100% stable, never dropping, and after the update to Ubuntu 22.04 LTS, things have started to go wild.

After revisiting many other questions in Server Fault and Super User regarding OOM, I'm running out of ideas to test more options, so I wonder if anyone could suggest other new possibilities for me to test

3
  • Track the PHP processes' memory usage over time. You could have a memory leak.
    – Daniel B
    Oct 3, 2023 at 11:20
  • Yes, there should be a memory leak because I've tracked the memory and it drops massively. But what it's strange is the fact that it started after the update. I thought it could be due to 7.4->8.2 php update but rolling back to 7.4 doesn't sort the issue. Also I have discarded a software code issue, because it has been working for +3 years untouched, and all started after update. I think I have spotted which process socket is leaking the memory but I'm running out of ideas on how to drill this down and if there is an option so I could stop the process leak before it drops the service
    – SirLouen
    Oct 3, 2023 at 12:24
  • @SirLouen I have a similar problem, using php debugbar for my measurements. On boot, the page loads using about 9-10MB, but over the day, this same page uses more and more memory at each load, usually goes up to 60-70MB after 8 hours. Have you found any new insights?
    – bilogic
    Nov 14, 2023 at 13:10

1 Answer 1

1

There was a memory leak due to a Wordpress plugin (WP-Rocket)

I was able to identify this thanks to this answer in another question:

https://stackoverflow.com/a/20590805/4442122

That pointed out to the exact place where the leak was being produced. After going down, I found the cause. It was not simply at all, specially because there was a massive system behind (WP) so the issue could come from anywhere (specially because everything loads from the home index.php in WP).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .