CustomBuild: an nginx-only update restarts every PHP-FPM version and Apache (twice) - please use reloads and skip unaffected services

Hosted Power

Verified User
Joined
Apr 13, 2018
Messages
13
Setup: DirectAdmin 1.713 (08cffb7), Debian 12, webserver=nginx_apache, modsecurity=yes, PHP-FPM 7.4 / 8.0 / 8.1 / 8.3 / 8.4. Auto-updates via build cron_execute with updates=yes.

What happens: the only pending update was nginx 1.31.8 -> 1.31.9. cron_execute ran for 46 s. After compiling nginx, CustomBuild did this (timestamps from the systemd journal):

  • +25 s: rewrite ips -> restart (stop/start) of all 5 php-fpmXX services -> ModSecurity rule set reinstall -> "Restarting apache." (restart, 1.3 s down)
  • +34 s: rewrite ips again -> all 5 php-fpmXX restarted again -> ModSecurity rule set reinstalled again
  • +37 s: rewrite nginx (8.9 s) -> "Restarting nginx." (restart)
  • +62 s: reload of nginx, httpd and all php-fpm services

Impact (measured with probes against 6 sites, ~5 requests/s each): every site returned 502/503, or had its connection refused, 6-8 times in a 36-second window. That is about 2 s of errors per site, and every request in progress at each restart was cut off. The new nginx binary itself was in place after 25 s. Customers' uptime monitors see this as an "outage" and open tickets about it.

Request:
  1. When only nginx is updated, don't touch PHP-FPM or Apache. When only Apache is updated, don't touch PHP-FPM.
  2. Use graceful operations instead of stop/start: nginx binary upgrade with kill -USR2 + QUIT (or at least reload), apachectl graceful for Apache, reload for PHP-FPM.
  3. Don't run the rewrite ips + PHP-FPM restart + ModSecurity install sequence twice per build.
  4. Robustness: the "current version" checks for Apache and nginx depend on $PATH. Under cron's default PATH=/usr/bin:/bin, httpd/nginx (in /usr/sbin) aren't found, so build versions reports them as updatable and cron_execute rebuilds and restarts Apache and nginx on every run. Please use absolute paths for these checks, or treat "binary not found" as "unknown" rather than "update available".

We can provide the full cron_execute output and journal excerpts if useful.
 
Back
Top