From: php at edwardk dot info
Operating system: Windows 2003
PHP version: 5.2.1
PHP Bug Type: Reproducible crash
Bug description: Apache child exits when PHP memory limit reached
Description:
------------
Running Apache 1.3.37 with PHP 5.2.1 on Windows 2003 Standard 32bit
The following PHP code was called from a browser with the size=149 (to
simulate 149MB use) and the PHP memory limit is 160M.
Reproduce code:
---------------
<?
ini_set('display_errors',true);
if (isset($_GET['size']) && $_GET['size'] < 200) {
$mb = intval($_GET['size']);
}
else {
$mb=5;
}
$var = '';
echo 'Memory limit: '.ini_get('memory_limit').'<br>';
for ($i=0; $i<=$mb; $i++) {
$var.= str_repeat('a',1*1024*1024);
echo memory_get_usage().'<br>';
}
echo 'String length: '. strlen($var);
?>
Expected result:
----------------
PHP should, if it did run out of memory, exit with something along the
lines of
Fatal error: Allowed memory size of xxx bytes exhausted (tried to
allocate yyy bytes)
otherwise, the script should execute without crashing.
Actual result:
--------------
Apache child exits, browser waiting for the result of the page get a TCP
connection reset and no page loaded.
--
Edit bug report at http://bugs.php.net/?id=40770&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40770&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40770&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40770&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40770&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40770&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40770&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40770&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40770&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40770&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40770&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40770&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40770&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40770&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40770&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40770&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40770&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40770&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40770&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40770&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40770&r=mysqlcfg