From: dmih at in-solve dot ru
Operating system: Win32/all
PHP version: 4.3.9
PHP Bug Type: Feature/Change Request
Bug description: FATAL: erealloc(): Unable to allocate...
Description:
------------
We are hosting provider, running PHP for a years.
We are using Apache 1.3.* / PHP, now they are latest versions.
Apache 1.3.33, PHP 4.3.9. That feature is version independent.
Sometimes this code fails (zend_alloc.c):
if (!p) {
if (!allow_failure) {
fprintf(stderr,"FATAL: erealloc(): Unable to allocate
%ld bytes\n",
(long) size);
#if ZEND_DEBUG && HAVE_KILL && HAVE_GETPID
kill(getpid(), SIGSEGV);
#else
exit(1);
#endif
}
ADD_POINTER_TO_LIST(orig);
HANDLE_UNBLOCK_INTERRUPTIONS();
return (void *)NULL;
}
In Apache log you see "FATAL: erealloc(): Unable to allocate..." and
process is killed.
There are different numbers while trying to allocate, all funny (something
about 1.5 mb, 300 kb, even 54 kb, so on).
The problem is that under Win32 the only Apache working process is killed.
That does not harm general operation, process is recreated, but that
prevents long file downloads.
I've seen many instances of this bug but they all seems odd. I want to
have some definite solution: let the script that cannot realloc die, but
PLEASE do not die the whole working process.
I have absolutely no idea how to prevent apache from restarting child
processes with such your behaviour. It seems that under Win32 it is
impossible.
I may add that memory limit for PHP script is 8mb (but it is unrelated, we
used to have 256 mb with same probability of these errors).
Reproduce code:
---------------
There is no code definitely known to reproduce the error; the code is not
the point.
Expected result:
----------------
I want some solution to let Apache working process survive this issue
regardless of the cause. That is very important.
I want to control the behaviour of this code point to make it allow to
terminate current script, but not the whole process (it seems
unreasonable).
--
Edit bug report at http://bugs.php.net/?id=31052&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31052&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31052&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31052&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31052&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31052&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31052&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31052&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31052&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31052&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31052&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31052&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31052&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31052&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31052&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31052&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31052&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31052&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31052&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31052&r=mysqlcfg