php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #31052 FATAL: erealloc(): Unable to allocate...
Submitted: 2004-12-10 10:42 UTC Modified: 2015-01-08 23:17 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: dmih at in-solve dot ru Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.9 OS: Win32/all
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dmih at in-solve dot ru
New email:
PHP Version: OS:

 

 [2004-12-10 10:42 UTC] dmih at in-solve dot ru
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).


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-08 23:17 UTC] ajf@php.net
-Status: Open +Status: Not a bug -Package: Feature/Change Request +Package: *General Issues
 [2015-01-08 23:17 UTC] ajf@php.net
That error isn't actually a bug itself, it's usually just a symptom of other bugs. Probably due to some memory corruption bug somewhere. That or your system ran out of RAM. So I'm marking this as "Not a bug".
 [2015-01-08 23:18 UTC] ajf@php.net
Also, in such a situation the engine is unstable so we can't just "not die", sorry.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Jun 13 21:00:01 2026 UTC