sous-chefs/php

Too many pool creation fail to restart

matthieumota opened this issue · 3 comments

When chef script have too many pool creation (>=5), Chef print an error for restart fpm service, because "php5-fpm.service start request repeated too quickly", it's due to notifies in install action (One time is enough). I've not the time to optimise the thing for the moment. If somebody can do this quickly else i can do this late.

@matthieumota Is this still a problem? If you could give a few more details about the issue that you are seeing that would be appreciated. If you do have time to contribute a fix that would also be appreciated.

@iennae Hey, I don't know if is still a problem but I was writing a PR and will not be merged #161 because can break compatibility. Not important today, we can close this issue :)

I ran into this issue myself.

  • Platform: Ubuntu 18.04
  • Chef version: 14.3.37
  • Cookbook version: 7.0.0

The error listed pointed me to running "systemctl status php5.6-fpm.service". Returned output:

Oct 08 00:39:37 ip-10-4-3-38 systemd[1]: php5.6-fpm.service: Start request repeated too quickly.
Oct 08 00:39:37 ip-10-4-3-38 systemd[1]: php5.6-fpm.service: Failed with result 'start-limit-hit'.

Further investigation showed it to be caused by the default setting for StartLimitIntervalSec and StartLimitBurst. By default, it checks for 5 restarts within 10 seconds, and will error out if you exceed this limit. I updated the unit definition in /lib/systemd/system/php5.6-fpm.service to include StartLimitBurst=0 in order to disable it, and was able to converge without issue. Since it only occurs on pool creation, as long as you're not adding more than 5 pools at once you won't run into this issue.

Not sure how to fix this inside of the cookbook itself. At first I thought :delayed would do the trick, but I see that it's actually the default timer for a notify, and since the restart does not have anything specified, it already uses :delayed. Which does bring up the question of why it's restarting after each pool is created, since to my understanding this should only run once at the end of the chef run.

I'd be very hesitant to touch the unit definition, especially since StartLimitBurst is there to prevent restart loops. My current solution in my recipe is to modify the unit file and add StartLimitBust=0, generate all the pools, then revert back to the original copy. Since I'm bootstrapping a fresh system that will be imaged, and not running Chef continuously, I don't need to worry about modifying the file like this because it only occurs once, but the same may not hold true for others who do run Chef continuously.