Skip to main content

apache_php_fpm keeps going down and restarting

Comments

2 comments

  • Kenric Ashe

    Did you ever find an answer? On my AlmaLinux VPS it only happens once or maybe a few times a week and always resolves on its own within 5 minutes, but false alarms are annoying and I, too, would like to know the meaning of error number 29. I've found no reason for apache_php_fpm to be down nor did it even appear to actually be down when I happened to be logged in via ssh when I got the email tonight. phpMyAdmin works normally and CPU for example was 99.8% idle and memory was 4.7G free. Nothing useful in journalctl nor `/var/log/chkservd.log`. The only clue is that mysterious error 29. 🤔

    0
  • nootkan

    I know this is an old thread but I recently had a similar issue and thought I'd share my findings in case anyone else is interested or it may be helpful in any way.

    I recently experienced what appears to be the same apache_php_fpm failure with:

    The subprocess /usr/local/cpanel/scripts/restartsrv_apache_php_fpm reported error number 29

    I spent some time going through the PHP-FPM, chkservd, cron and logrotate logs and found what appears to be a timing/race condition rather than an actual prolonged PHP-FPM outage.

    In my case, chkservd started its service check at 03:58:59. At almost exactly the same time, the scheduled weekly logrotate process caused PHP 7.4 FPM to reopen its error log. PHP-FPM then reloaded and was reporting:

    fpm is running
    ready to handle connections
    by 03:59:03.

    Chkservd nevertheless reported “Apache PHP-FPM 74 service is down,” attempted a restart and received error number 29. The failure notification was generated at 03:59:07.

    About six minutes later I received the recovery notification. However, the PHP-FPM log shows that FPM had actually been ready again within about one second. The six-minute period appears to simply be the interval before chkservd performed its next service check.

    I also found an earlier occurrence on August 2. That time chkservd reported BOTH PHP 7.4 and PHP 8.2 down during the same weekly logrotate window. The timing was almost identical:

    • 04:00:24 – chkservd started its service check
    • 04:00:25 – PHP-FPM reopened its logs
    • 04:00:27 – PHP-FPM reloaded and reported “ready to handle connections”
    • chkservd nevertheless reported PHP 7.4 and PHP 8.2 down and the restart script returned error 29

    Server resources were nowhere near exhausted during either event. Apache remained operational, memory and CPU usage were low and I found no Apache MaxRequestWorkers or scoreboard exhaustion errors.

    My logs therefore strongly suggest there may be a timing/race condition between PHP-FPM log rotation and chkservd. If chkservd checks apache_php_fpm at almost exactly the same moment PHP-FPM is reopening its logs/reloading, the check/restart script may return error 29 even though PHP-FPM becomes operational almost immediately.

    I can't say this proves a cPanel bug, but the timing was repeatable enough on my server that I thought the information might help anyone else troubleshooting the same error.

    1

Please sign in to leave a comment.