Resolved: Ubuntu php5-fpm throws error “unknown instance” on service reload
Rather short post this time around. It turns out there is a known issue that when you perform a service reload on php5-fpm you might encounter yourself with a bit of a problem. The use of reload is meant to result in a reloading of the settings without disturbing current users of the service. Typically this means new clients are serviced with the new settings while existing clients still enjoy the old settings until the process/thread is terminated and replaced by a new one with new settings. This is done as it is the best way to smoothly transition between settings. The alternative of restarting a service means existing clients are potentially dropped and there is a small downtime in the service. The problem here then lies in that transition period. For some reason the existing instance’s reference is lost resulting in php5-fpm throwing the error “unkown instance”. So now you are stuck with processes that are running which you can’t control.
Unfortunately thus far the only solution I have found is to stay away from service reload on php5-fpm and instead use service restart. As mentioned earlier it does come at a cost but at least you are still able to control the service using the service command and you are sure your new settings have taken effect.
If you have already reloaded the configuration and you are experiencing issues you will have to manually kill the PHP FPM Processes. You can run:
to see which processes are currently running. After killing them you can start again the service and you can stop properly again.
As usual don’t forget to test your configuration file using “php5-fpm -t” on the command line!