I've noticed that one of our servers starts returning errors just after logrotate runs, i.e. in nginx error log I can see:
[error] 8501#0: *118126869 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: xxx.yyy.zz.ww, server: www.test.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9011", host: "www.test.com"
I have tried adding a postrotate action that would make the php reload gracefully but the error is still happening, our current logrotate is as follows:
/var/log/php5-fpm.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 644 root root
postrotate
[ ! -f /var/run/php5-fpm.pid ] || kill -USR2 `cat /var/run/php5-fpm.pid`
endscript
}
PHP config is as follows:
[www-9011]
user = www-data
group = www-data
listen = 127.0.0.1:9011
listen.backlog = 65535
pm = ondemand
pm.max_children = 50
pm.process_idle_timeout = 10s;
pm.max_requests = 500
rlimit_files = 16384
chdir = /
catch_workers_output = no
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on
We're running on ubuntu 12.04 and php 5.3.10