php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61083 Apache/mod_php ignores SIGHUP
Submitted: 2012-02-14 14:34 UTC Modified: -
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (66.7%)
From: dmitry@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.4SVN-2012-02-14 (SVN) OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dmitry@php.net
New email:
PHP Version: OS:

 

 [2012-02-14 14:34 UTC] 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.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-05 10:12 UTC] laruence@php.net
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)
 [2015-03-05 10:12 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-07-20 11:39 UTC] davey@php.net
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)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon May 12 02:01:27 2025 UTC