I'm using php-fpm with customer separate pools.
Sometimes page are freezing, then showing 500 internal server error, and I'm getting such errors in error log:
[11-Feb-2013 22:12:39] ERROR: unable to read what child say: Bad file descriptor (9)
[11-Feb-2013 22:12:39] ERROR: unable to read what child say: Bad file descriptor (9)
[11-Feb-2013 22:12:42] WARNING: [pool oferty] child 31186 exited on signal 11 (SIGSEGV) after 198.250454 seconds from start
My current settings are:
[admin]
listen = 127.0.0.1:51006
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
user = admin
group = admin
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 2
pm.max_requests = 1000
;pm.status_path = /status
;ping.path = /ping
;ping.response = pong
request_terminate_timeout = 180s
request_slowlog_timeout = 180s
slowlog = /var/log/php-fpm/slow.log
rlimit_files = 1024
rlimit_core = 0
;chroot =
;chdir = /var/www
catch_workers_output = yes
security.limit_extensions = .php .php3 .php4 .php5
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
;php_flag[display_errors] = off
php_admin_value[error_log] = /var/log/php-fpm/error.log
php_admin_value[session.save_path] = /var/lib/php/session
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 128M
What should be increased ? My server is using Intel Core i7 2600 3.4 GHz (8 threads) + 32 GB RAM, 2xSSD 120 GB Software RAID1 + 2x HDD 3 TB Software RAID
Increased:
and all problems are gone ;)
I managed to fix this issue by correcting file permissions on the logs.
Make sure your configured log files are both readable and writable by the user running php-fpm.
For me, MySQL was causing the error after hitting the default 150 max_connection limit. Change the default in
my.cnf
or on mysql8, you can update it persistently with the DB running.Of course, choose a number of connections that suits your production environment.
Changes to FPM settings did not work for me. I even tried creating a massive static pool in FPM of 5000 workers.
After trapping logs at the same time the error was occurring, I found MySQL was at the max_connection limit using
show process list;
.