|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-06-04 23:06 UTC] jonepet at dcvhost dot no
Description: ------------ This is a duplicate of older closed Bug #36158. Solved in previous version, but broken again in newer (because of replaced lib?). The FastCGI module in PHP does not handle graceful/SIGTERM shutdown/reload correctly. When sending a graceful reload to Apache, all running PHP processes dies, and Apache return "500 Internal Server Error" to waiting HTTP clients. Reproduce code: --------------- <?php sleep(10); echo "Done"; ?> Open in a web browser and then do an apache2ctl graceful on the server. Expected result: ---------------- "Done" should be printed to the web browser after 10 seconds. Actual result: -------------- "Internal Server Error" to browser and "premature end of script headers" to log file. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 21:00:01 2025 UTC |
The mod_fastcgi patch above works with PHP5 (5.2.3 here). But PHP 4 does not have a signal handler for SIGTERM, so it exits immediatly without finishing the current request and still gives a 500. Adding a signal handler for SIGTERM seems to solve this problem: --- os_unix.c.orig 2008-06-02 11:29:25.000000000 +0200 +++ os_unix.c 2008-06-02 11:29:46.000000000 +0200 @@ -147,6 +147,7 @@ sa.sa_handler = OS_Sigusr1Handler; installSignalHandler(SIGUSR1, &sa, force); + installSignalHandler(SIGTERM, &sa, force); } /*