php-fpm - server reached pm.max_children setting, consider raising it
Posted: Mon Aug 15, 2022 5:59 pm
I recently spun up a new machine on Oracle Linux 8 with php 7. The first time I fired up Zoneminder, the logs were complaining about not finding www.sock, so a new package called php-fpm was installed, which resolved the issue.
After about a day, I could no longer bring up the web interface. I checked /var/log/php-fpm.log and it had:
So I did as it recommended, and increased pm.max_children to 100 in the /etc/php-fpm.d/www.conf file.
The next day, the same issue returned:
I raised it again, but as you can imagine, this is merely putting off the inevitable. You can see over time the number of forked processes for php-fpm grow:
The issue is easily resolved with a systemctl reload php-fpm, so for now, I put a crontab daily task to do this to cover up the issue, but I'm wondering if anyone has run into this or has a better idea? In fact, I wouldn't be shocked if it was related to the memory leak threads, but I don't know. I have noticed the memory used for the zoneminder process keeps increasing over time, and swap is eventually used.
If you read this far, thanks!
After about a day, I could no longer bring up the web interface. I checked /var/log/php-fpm.log and it had:
Code: Select all
[14-Aug-2022 09:24:23] WARNING: [pool www] server reached pm.max_children setting (50), consider raising it
The next day, the same issue returned:
Code: Select all
[14-Aug-2022 09:24:23] WARNING: [pool www] server reached pm.max_children setting (100), consider raising it
Code: Select all
[root@zm8 ~]# ps -ylC php-fpm --sort:rss
S UID PID PPID C PRI NI RSS SZ WCHAN TTY TIME CMD
S 0 408575 1 0 80 0 24788 75908 - ? 00:00:07 php-fpm
S 48 1190904 408575 0 80 0 27260 81134 - ? 00:00:17 php-fpm
S 48 1190901 408575 0 80 0 27304 81134 - ? 00:00:44 php-fpm
S 48 1190905 408575 0 80 0 27308 81134 - ? 00:00:21 php-fpm
S 48 1210446 408575 0 80 0 27312 81134 - ? 00:00:19 php-fpm
S 48 1197151 408575 0 80 0 27316 81134 - ? 00:02:45 php-fpm
....
....
...
S 48 1380619 408575 0 80 0 27388 81134 - ? 00:01:35 php-fpm
S 48 1445589 408575 1 80 0 27412 81134 - ? 00:08:30 php-fpm
S 48 1507951 408575 1 80 0 27412 81134 - ? 00:03:11 php-fpm
S 48 1405821 408575 0 80 0 27416 81134 - ? 00:01:10 php-fpm
S 48 1407333 408575 0 80 0 27416 81134 - ? 00:02:29 php-fpm
S 48 1414085 408575 0 80 0 27420 81134 - ? 00:01:20 php-fpm
S 48 1239524 408575 0 80 0 27428 81134 - ? 00:03:57 php-fpm
S 48 1306148 408575 0 80 0 27432 81134 - ? 00:07:56 php-fpm
S 48 1241461 408575 0 80 0 27460 81134 - ? 00:01:16 php-fpm
S 48 1267270 408575 0 80 0 27472 81134 - ? 00:08:19 php-fpm
S 48 1402922 408575 0 80 0 27480 81134 - ? 00:01:20 php-fpm
If you read this far, thanks!