The php-fpm man page states the response to a USR2 signal is: "graceful reload of all workers + reload of fpm conf/binary". However, in testing I find that a reload actually kills workers processing requests. I was expecting requests to be allowed to finish before the processes were killed and re-spawned.
Is this broken, my expectation wrong, or test invalid?
My test setup:
Ubuntu 16.04 LXC container
install php7.0-fpm and nginx
php script to sleep and output countdown each second
send request to sleep for 30 seconds via curl
issue reload via systemctl
Test result:
request was killed immedietly upon reload
Best Answer
I just found my answer: configuration option
process_control_timeout
was set to a default value of 0 seconds. A terrible default in my opinion.I set
process_control_timeout
to a value of30s
to allow child processes up to 30 seconds to complete and quit before being forcibly killed. However, this takes effect only on subsequent reloads as the first reload is required to put this change into effect.