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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 18:01:28 2024 UTC