From: askalski at gmail dot com
Operating system: redhat
PHP version: 5.2.6
PHP Bug Type: Reproducible crash
Bug description: zend_bailout can deadlock APC
Description:
------------
A zend_bailout (longjmp) is allowed while HANDLE_BLOCK_INTERRUPTIONS is in
effect. When this happens while APC has its shared memory segment locked,
it results in corruption of the segment and deadlocking of the mutex. An
Apache restart is required to get things moving again.
Tested with PHP 5.2.6 and 4.4.8 with APC 3.0.19 using pthread mutexes.
In our particular case, this is happening when a script hits the
max_execution_time timeout during an include().
Although APC is involved, I am submitting this as a PHP bug because the
fix (zend_bailout / HANDLE_BLOCK_INTERRUPTIONS) is completely PHP-side.
Reproduce code:
---------------
<?php
header('Content-Type: text/plain');
echo "Fetching value from APC...\n";
flush();
apc_fetch('deadlock');
echo "Attempting to deadlock APC with max_execution_time...\n";
flush();
ini_set('max_execution_time', 1);
for (;;) apc_store('deadlock', 1);
?>
Expected result:
----------------
Defer the zend_bailout until HANDLE_UNBLOCK_INTERRUPTIONS is called.
Actual result:
--------------
Deadlock of the entire web server, requiring an Apache restart.
--
Edit bug report at http://bugs.php.net/?id=46025&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46025&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46025&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46025&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46025&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=46025&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46025&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46025&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46025&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46025&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46025&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46025&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46025&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46025&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46025&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46025&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46025&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46025&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46025&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46025&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46025&r=mysqlcfg