Bug #61083 [Opn->Csd]: Apache/mod_php ignores SIGHUP

From: Date: Thu, 05 Mar 2015 10:12:12 +0000
Subject: Bug #61083 [Opn->Csd]: Apache/mod_php ignores SIGHUP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191185@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61083&edit=1

 ID:                 61083
 Updated by:         laruence@php.net
 Reported by:        dmitry@php.net
 Summary:            Apache/mod_php ignores SIGHUP
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Linux
 PHP Version:        5.4SVN-2012-02-14 (SVN)
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fd5a756ad44124ffa7e9a5810a31ff49e91708cf
Log: Revive Zend Signals handler (and fixed bug #61083)


Previous Comments:
------------------------------------------------------------------------
[2012-02-14 14:34:00] dmitry@php.net

Description:
------------
Test Case
---------
1) Just start Apache with mod_php
2) generate some load (e.g. ab -t 120 http://.../hello.php)
3) run 'apachectl restart' for few times
4) 'apachectl stop'
5) Check Apache error_log

You will see warning and error messages:

[warn] child process 15317 still did not exit, sending a SIGTERM

[error] child process 15317 still did not exit, sending a SIGKILL

The reason of these errors is the fact that Apache/mod_php worker processws ignore SIGHIP and the
main Apache process kills them using SIGTERM or SIGKILL.

I tried to analyze and debug zend_signal.c and found very wired behavior.

On first request zend_signal_activate() sets its own signal handler for SIGHUP and stores the
original handler in SIGG(handlers)[SIGHUP-1].handler, but on second request the same
zend_signal_activate() overwrites the original signal handler by handler from parent process.

zend_signal.c:284

memcpy(&SIGG(handlers), &global_orig_handlers, sizeof(global_orig_handlers));

As result the original signal handler for SIGHUP is never called.
Even worse after restart and two request SIGG(handlers)[SIGHUP-1].handler becomes SIG_IGN and SIGHUP
is ignored at all.




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=61083&edit=1


Thread (2 messages)

« previous php.bugs (#191185) next »