#46025 [Com]: zend_bailout can deadlock APC
| From: | pierre at archlinux dot de | Date: | Fri, 27 Feb 2009 20:09:28 +0000 |
| Subject: | #46025 [Com]: zend_bailout can deadlock APC | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-134261@lists.php.net to get a copy of this message | ||
ID: 46025
Comment by: pierre at archlinux dot de
Reported By: askalski at gmail dot com
Status: Suspended
Bug Type: Reproducible crash
Operating System: redhat
PHP Version: 5.2.6
New Comment:
This problem is still reproducable with version 5.2.9. The cgi version
is affected, too (as expected).
Previous Comments:
------------------------------------------------------------------------
[2009-02-15 00:01:20] dan at archlinux dot org
Any progress here? This is definitely reproducible and we have seen it
on archlinux.org about once every 3 or 4 days- it kind of stinks. Is
there any current workaround besides increasing the timeout value and
hoping for the best?
Running:
Apache 2.2.11
PHP 5.2.8
APC 3.0.19
------------------------------------------------------------------------
[2008-09-09 00:46:09] scottmac@php.net
This is essentially what http://wiki.php.net/rfc/zendsignals is for, it
was considered for PHP 5.3 but has been deferred for the moment.
------------------------------------------------------------------------
[2008-09-08 23:56:04] askalski at gmail dot com
Reproduced with latest checkouts from both the PHP_5_2 and PHP_5_3
tags.
X-Powered-By: PHP/5.2.7-dev
X-Powered-By: PHP/5.3.0alpha3-dev
------------------------------------------------------------------------
[2008-09-08 21:16:43] jani@php.net
Can you reproduce this with latest CVS checkout of PHP_5_2 (and
preferrably PHP_5_3) ??
------------------------------------------------------------------------
[2008-09-08 20:50:12] askalski at gmail dot com
To assist with implementing a fix:
I wrote up a local fix that uses two executor globals:
/* HANDLE_BLOCK_INTERRUPTIONS nesting depth */
zend_uint blocking_interruptions;
/* true if a bailout was deferred while interruptions were blocked
*/
zend_bool deferred_bailout;
In my testing, I quickly realized that APC in conjunction with Zend was
making nested calls to HANDLE_BLOCK_INTERRUPTIONS(), so to keep from
unblocking prematurely, it was necessary to track nesting depth.
Example from my debugging:
Block 0 /tmp/APC-3.0.19/php_apc.c:559
Block 1 /tmp/php-5.2.6/Zend/zend_alloc.c:1876
Unblock 1 /tmp/php-5.2.6/Zend/zend_alloc.c:1913
Unblock 0 /tmp/APC-3.0.19/php_apc.c:592
My updated macros:
#define HANDLE_BLOCK_INTERRUPTIONS() if
(!EG(blocking_interruptions)++) { if (zend_block_interruptions) {
zend_block_interruptions(); } }
#define HANDLE_UNBLOCK_INTERRUPTIONS() if
(EG(blocking_interruptions) && !--EG(blocking_interruptions)) { if
(zend_unblock_interruptions) { zend_unblock_interruptions(); } if
(EG(deferred_bailout)) { zend_bailout(); } }
And my mod to _zend_bailout:
if (EG(blocking_interruptions))
{
EG(deferred_bailout) = 1;
return;
}
EG(deferred_bailout) = 0;
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/46025
--
Edit this bug report at http://bugs.php.net/?id=46025&edit=1