php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32002 FATAL erealloc() Restarts
Submitted: 2005-02-16 19:10 UTC Modified: 2005-03-05 01:00 UTC
Votes:70
Avg. Score:4.8 ± 0.6
Reproduced:64 of 65 (98.5%)
Same Version:22 (34.4%)
Same OS:43 (67.2%)
From: tlamay at cte1 dot com Assigned:
Status: No Feedback Package: Unknown/Other Function
PHP Version: 4CVS-2005-02-17 OS: Windows 2003
Private report: No CVE-ID: None
 [2005-02-16 19:10 UTC] tlamay at cte1 dot com
Description:
------------
This problem occurs with PHP 4.3.9 and 4.3.10 and CVS versions of 4.3.11.  Below is a snippet from Apache 2.0.52 error log.  This restarting problem does not occur with 4.3.6 and 4.3.7.  I have not fully tested 4.3.8.  The restarts occur at regular intervals, and the least frequently with 4.3.10 (averaging every 30-45m).  The Apache child thread restarts causing all web clients to disconnect (I guess this issue is particularly bad on Windows since there's only one child?)  This can cause my ecommerce customers to loose POST data or mess up their orders in other ways, and at least cause time out issues on pages.

I would love to know how to backtrace on Windows but I cant seem to find instructions.  PHP error log isnt showing me anything relevant to the problem.  This is on a live system so Im not sure what code is causing this.  The server primarily runs osCommerce and vBulletin 3, all pages are pretty much PHP.

I've tried increasing the memory allocation for PHP scripts from 8m to 40m, but this hasn't had an effect.  Im willing to try other configurations as long as it doesn't disrupt my live websites too badly, to see where the bug might be.  

In regards to the system, it's currently running 1G of memory and is only using about half that at any given time.  I will be upgrading the server to 3G of memory, however, Im not sure the physical memory is a limitation, apart from a memory leak somewhere.


Thanks

Wed Feb 16 11:20:58 2005] [notice] Parent: Created child process 5376
[Wed Feb 16 11:20:58 2005] [notice] Disabled use of AcceptEx() WinSock2 API
[Wed Feb 16 11:21:06 2005] [notice] Child 5376: Child process is running
[Wed Feb 16 11:21:06 2005] [notice] Child 5376: Acquired the start mutex.
[Wed Feb 16 11:21:06 2005] [notice] Child 5376: Starting 750 worker threads.
[Wed Feb 16 11:21:06 2005] [notice] Child 5376: Listening on port 443.
[Wed Feb 16 11:21:06 2005] [notice] Child 5376: Listening on port 443.
[Wed Feb 16 11:21:06 2005] [notice] Child 5376: Listening on port 80.
[Wed Feb 16 11:21:06 2005] [notice] Child 5376: Listening on port 80.
FATAL:  erealloc():  Unable to allocate 22528 bytes
[Wed Feb 16 11:42:05 2005] [notice] Parent: child process exited with status 1 -- Restarting.
[Wed Feb 16 11:42:07 2005] [notice] Parent: Created child process 388
[Wed Feb 16 11:42:07 2005] [notice] Disabled use of AcceptEx() WinSock2 API
[Wed Feb 16 11:42:14 2005] [notice] Child 388: Child process is running
[Wed Feb 16 11:42:14 2005] [notice] Child 388: Acquired the start mutex.
[Wed Feb 16 11:42:14 2005] [notice] Child 388: Starting 750 worker threads.
[Wed Feb 16 11:42:14 2005] [notice] Child 388: Listening on port 443.
[Wed Feb 16 11:42:14 2005] [notice] Child 388: Listening on port 443.
[Wed Feb 16 11:42:14 2005] [notice] Child 388: Listening on port 80.
[Wed Feb 16 11:42:14 2005] [notice] Child 388: Listening on port 80.
FATAL:  erealloc():  Unable to allocate 22528 bytes
[Wed Feb 16 12:26:05 2005] [notice] Parent: child process exited with status 1 -- Restarting.
[Wed Feb 16 12:26:06 2005] [notice] Parent: Created child process 6032
[Wed Feb 16 12:26:06 2005] [notice] Disabled use of AcceptEx() WinSock2 API
[Wed Feb 16 12:26:14 2005] [notice] Child 6032: Child process is running
[Wed Feb 16 12:26:14 2005] [notice] Child 6032: Acquired the start mutex.
[Wed Feb 16 12:26:14 2005] [notice] Child 6032: Starting 750 worker threads.
[Wed Feb 16 12:26:14 2005] [notice] Child 6032: Listening on port 443.
[Wed Feb 16 12:26:14 2005] [notice] Child 6032: Listening on port 443.
[Wed Feb 16 12:26:14 2005] [notice] Child 6032: Listening on port 80.
[Wed Feb 16 12:26:15 2005] [notice] Child 6032: Listening on port 80.
Terminating on signal SIGTERM(15)
[Wed Feb 16 12:33:19 2005] [notice] Parent: Created child process 2044
[Wed Feb 16 12:33:19 2005] [notice] Disabled use of AcceptEx() WinSock2 API
[Wed Feb 16 12:33:26 2005] [notice] Child 2044: Child process is running
[Wed Feb 16 12:33:26 2005] [notice] Child 2044: Acquired the start mutex.
[Wed Feb 16 12:33:26 2005] [notice] Child 2044: Starting 750 worker threads.
[Wed Feb 16 12:33:26 2005] [notice] Child 2044: Listening on port 443.
[Wed Feb 16 12:33:26 2005] [notice] Child 2044: Listening on port 443.
[Wed Feb 16 12:33:26 2005] [notice] Child 2044: Listening on port 80.
[Wed Feb 16 12:33:26 2005] [notice] Child 2044: Listening on port 80.





Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-17 05:10 UTC] tlamay at cte1 dot com
I tried the very latest one, and as what happened when I tried the CVS before, it actually makes the problem much worse.  Apache restarts every 5-10-15 minutes now versus every 30-45m with PHP 4.3.10.

[Wed Feb 16 21:52:39 2005] [notice] Parent: Created child process 3148
[Wed Feb 16 21:52:39 2005] [notice] Disabled use of AcceptEx() WinSock2 API
[Wed Feb 16 21:52:48 2005] [notice] Child 3148: Child process is running
[Wed Feb 16 21:52:48 2005] [notice] Child 3148: Acquired the start mutex.
[Wed Feb 16 21:52:48 2005] [notice] Child 3148: Starting 750 worker threads.
[Wed Feb 16 21:52:48 2005] [notice] Child 3148: Listening on port 443.
[Wed Feb 16 21:52:48 2005] [notice] Child 3148: Listening on port 443.
[Wed Feb 16 21:52:48 2005] [notice] Child 3148: Listening on port 80.
[Wed Feb 16 21:52:48 2005] [notice] Child 3148: Listening on port 80.
FATAL:  erealloc():  Unable to allocate 90112 bytes
[Wed Feb 16 22:03:25 2005] [notice] Parent: child process exited with status 1 -- Restarting.
[Wed Feb 16 22:03:26 2005] [notice] Parent: Created child process 852
[Wed Feb 16 22:03:26 2005] [notice] Disabled use of AcceptEx() WinSock2 API
[Wed Feb 16 22:03:35 2005] [notice] Child 852: Child process is running
[Wed Feb 16 22:03:35 2005] [notice] Child 852: Acquired the start mutex.
[Wed Feb 16 22:03:35 2005] [notice] Child 852: Starting 750 worker threads.
[Wed Feb 16 22:03:35 2005] [notice] Child 852: Listening on port 443.
[Wed Feb 16 22:03:35 2005] [notice] Child 852: Listening on port 443.
[Wed Feb 16 22:03:35 2005] [notice] Child 852: Listening on port 80.
[Wed Feb 16 22:03:35 2005] [notice] Child 852: Listening on port 80.
FATAL:  erealloc():  Unable to allocate 90112 bytes
[Wed Feb 16 22:09:17 2005] [notice] Parent: child process exited with status 1 -- Restarting.
[Wed Feb 16 22:09:18 2005] [notice] Parent: Created child process 1792
[Wed Feb 16 22:09:18 2005] [notice] Disabled use of AcceptEx() WinSock2 API
[Wed Feb 16 22:09:27 2005] [notice] Child 1792: Child process is running
[Wed Feb 16 22:09:27 2005] [notice] Child 1792: Acquired the start mutex.
[Wed Feb 16 22:09:27 2005] [notice] Child 1792: Starting 750 worker threads.
[Wed Feb 16 22:09:27 2005] [notice] Child 1792: Listening on port 443.
[Wed Feb 16 22:09:27 2005] [notice] Child 1792: Listening on port 443.
[Wed Feb 16 22:09:27 2005] [notice] Child 1792: Listening on port 80.
[Wed Feb 16 22:09:27 2005] [notice] Child 1792: Listening on port 80.
FATAL:  erealloc():  Unable to allocate 360448 bytes
[Wed Feb 16 22:14:22 2005] [notice] Parent: child process exited with status 1 -- Restarting.
[Wed Feb 16 22:14:24 2005] [notice] Parent: Created child process 2676
[Wed Feb 16 22:14:24 2005] [notice] Disabled use of AcceptEx() WinSock2 API
 [2005-02-17 05:25 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Please try the latest HEAD too so we'll see if this is any better there (some memleak fixes exist there which were not allowed to be backported to PHP_4_3 branch)

 [2005-02-17 20:46 UTC] tlamay at cte1 dot com
Okay, after a bit of tweaking I got the latest PHP5 running.  It crashes within 8-10 minutes.  I have since migrated back to 4.3.10, the most stable version for me at the moment.

Funny thing about the PHP5...when it crashes, Apache doesn't ever restart.  The server stays completely down.  I have to physically start it again.  This behavior doesnt occur in 4.3.x.

Thu Feb 17 14:31:26 2005] [notice] Parent: Created child process 6672
[Thu Feb 17 14:31:26 2005] [notice] Disabled use of AcceptEx() WinSock2 API
[Thu Feb 17 14:31:35 2005] [notice] Child 6672: Child process is running
[Thu Feb 17 14:31:35 2005] [notice] Child 6672: Acquired the start mutex.
[Thu Feb 17 14:31:35 2005] [notice] Child 6672: Starting 750 worker threads.
[Thu Feb 17 14:31:35 2005] [notice] Child 6672: Listening on port 443.
[Thu Feb 17 14:31:35 2005] [notice] Child 6672: Listening on port 443.
[Thu Feb 17 14:31:35 2005] [notice] Child 6672: Listening on port 80.
[Thu Feb 17 14:31:35 2005] [notice] Child 6672: Listening on port 80.
FATAL:  erealloc():  Unable to allocate 98304 bytes
[Thu Feb 17 14:39:29 2005] [notice] Parent: child process exited with status 1 -- Restarting.
 [2005-02-22 21:28 UTC] jonohlsson at hotmail dot com
must say i have this exact problem myself

running win 2k / apache 1.3.33 / php 4.3.10 / Zend optimizer 2.5.7 and phpBB forum

the apache log is filled with those erealloc errors and the browser page goes blank with a "server not found" message

...but i think it only happens if browsing with IE. mozilla works fine. weird isn't it?

i've also tried changing php.ini memory settings, but this deosn't affect the apache log at all
 [2005-02-25 15:15 UTC] jorton@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


The FATAL message correspond to Zend calling exit(), which kills all the threads in the process, so that much is expected.

To track down the memory issues you could add to your LogFormat directive: "%{mod_php_memory_usage}n" - this will log the maximum number of bytes allocated during each particular request.


 [2005-03-05 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-09-07 20:52 UTC] jeffdripps at isegames dot com
Using 4.4.1 binary this problem occurs and the process restarts as soon as the first *.php file is requested. PHP 4.4.1 is unusable on a multiprocessor machine running W2K and Apache2.
 [2005-09-18 16:40 UTC] pierre_c at editus dot lu
Our plateform is:

Win2K Server
Apache 1.3.29
PHP 4.3.7

And we have this error too:

FATAL:  erealloc():  Unable to allocate 360448 bytes

HTTP Server will stop after ~48h00 and our service is down. Have anybody fix this bug ? does I upgrade Apache/PHP ?
 [2005-11-28 03:26 UTC] broadmind at magicn dot com
I have also got this problem too. :_(
This is very serious one because sometimes it crashes apache server totally, causes to non-restart condition.
(I have to restart the computer at this time)

The memory sizs of PHP.ini didn't any effects on it. 

Our platform is:

AMD Opteron 2 CPU (multiprocessor)
Win2K Server
Apache 1.3.34
PHP 5.1.0

FATAL:  erealloc():  Unable to allocate xxx bytes

At this time, the child process is terminated and Apache is restarted automatically. This results in the loss of POST data or the error of page connection.
 [2006-01-01 12:18 UTC] vsitforum at yahoo dot com
I also experience this problem with my current home server

windows XP Professional SP2 
 apache 2.0.55 
 PHP 4.4.1 
 Zend optimizer 2.6.0

Hardware is pretty decent 
P4 2.8 CPU 
2GB of DDR400

The symtom is very much alike the very first post.I would like to know if there's anyway to fix this

Thank you
 [2006-04-14 12:23 UTC] php at softandem dot com
I also noticed this problem 

FATAL:  erealloc():  Unable to allocate xxxx bytes

with various version of windows/php/apache :

Windows 2000 server or Windows server 2003
PHP 4.4.1 (I think 4.3.2 too)
Apache 1.3.19, 1.3.34, 2.0.55

The problem is very critical because I use a php module that   keep sessions informations of my users in C++ objects which are lost when apache rotates.
The problem does not occur at regular interval but always. The problem occurs frequently when there is a lot of query passed from Internet Explorer 6.0 on a single windows machine (example : refreshing a page lots of times)

Thank you for your experiments on this issue.
 [2006-05-29 03:20 UTC] jcink2k at gmail dot com
I get this bug too. Is there any fix at all after all this time?
 [2006-07-04 13:22 UTC] vincent dot lepot at smile dot fr
This bug happens for me since I added in httpd.conf the option Win32DisableAcceptEx (because of the number of warnings appearing). When I comment it, there are no more memory leak. So it seems to be a Apache 2 bug.
 [2006-10-02 03:38 UTC] automap at gmail dot com
I also encounter this problem:
[Sun Oct 01 16:52:03 2006] [notice] Apache/2.0.59 (Win32) mod_jk2/2.0.4 PHP/5.0.4 configured -- resuming normal operations
[Sun Oct 01 16:52:03 2006] [notice] Server built: Jul 27 2006 15:55:03
[Sun Oct 01 16:52:03 2006] [notice] Parent: Created child process 460
[Sun Oct 01 16:52:03 2006] [notice] Disabled use of AcceptEx() WinSock2 API
[Sun Oct 01 16:52:03 2006] [notice] Child 460: Child process is running
[Sun Oct 01 16:52:03 2006] [notice] Child 460: Acquired the start mutex.
[Sun Oct 01 16:52:03 2006] [notice] Child 460: Starting 250 worker threads.
[Sun Oct 01 16:52:03 2006] [notice] Child 460: Listening on port 80.
[Sun Oct 01 18:39:30 2006] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Sun Oct 01 18:39:31 2006] [notice] Apache/2.0.59 (Win32) mod_jk2/2.0.4 PHP/5.0.4 configured -- resuming normal operations
[Sun Oct 01 18:39:31 2006] [notice] Server built: Jul 27 2006 15:55:03
[Sun Oct 01 18:39:31 2006] [notice] Parent: Created child process 2272
[Sun Oct 01 18:39:31 2006] [notice] Disabled use of AcceptEx() WinSock2 API
[Sun Oct 01 18:39:32 2006] [notice] Child 2272: Child process is running
[Sun Oct 01 18:39:32 2006] [notice] Child 2272: Acquired the start mutex.
[Sun Oct 01 18:39:32 2006] [notice] Child 2272: Starting 250 worker threads.
[Sun Oct 01 18:39:32 2006] [notice] Child 2272: Listening on port 80.
FATAL:  erealloc():  Unable to allocate 1049288 bytes
[Sun Oct 01 20:15:12 2006] [notice] Parent: child process exited with status 1 -- Restarting.

Who know how to overcome it?
Please send email to me: automap@gmail.com
 [2006-10-09 06:57 UTC] levi_tedder at hotmail dot com
Hi

I have the same problem.

My setup:
Win2k Server (2 cpu) 2 GB RAM
Apache 2.0.59
PHP 5.1.6
OpenSSL 0.9.8c

Error message in apache log
FATAL:  erealloc():  Unable to allocate 1572864 bytes

The exact same number of bytes is reported every 10-20 minutes, and after a day or two the apache cannot be restarted and I need to reboot the whole server.
Most of my scripts are using Pear DB for database handling.
I am unable to find out which script/page is causing this.

Also note that I'm using the Win32DisableAcceptEx (as I guess all others are) in apache conf to get rid of slow performance and a bunch of other errors (The specified network name is no longer available). The FATAL error only appear when using Win32DisableAcceptEx.

If you have any ideas, please let the PHP guys and me know it :)
 [2006-12-03 12:53 UTC] levi_tedder at hotmail dot com
I have installed PHP 5.2 on the server where I had this issue, and it seems to have fixed it. No fatal for 24 hours, but I will let you know if it reappears when traffic peeks (although traffic was not an issue when this happened).
 [2006-12-12 23:04 UTC] alex_25052 at hotmail dot com
Same thing here.

Tons of FATAL:  erealloc(): Unable to allocate xxxx bytes

I config is
PHP 4.4.4
Apache 2.2.3
on Windows 2003 Xeon Dual web machine, 2Gb ram.

Sometimes apache restarts by itself, sometimes it doesn't and i have to do it manualy

Drives me nuts... :)
 [2006-12-21 21:00 UTC] csaba at ai-media dot com
Our configuration:

Windows2003 Web Edition
PHP 5.2, ZendOptimizer 3
Apache 2.2.3
Tomcat 5.5.17

To reproduce: this happens consistently on the Windows platform as long as Win32DisableAcceptEx is enabled in the Apache httpd.conf. Tested with Apache2.0.59, PHP 5.1.6 and PHP 5.2. We get "FATAL:  erealloc():  Unable to allocate XXX bytes" in the Apache2 error log with 5.1.6 and no feedback to the user (could not connect to server), with 5.2 the user sees the same error message in the browser.

There's an open issue in the Apache2 bug list here: http://issues.apache.org/bugzilla/show_bug.cgi?id=34664#c8

Comment 8 is particularly interesting: one of the Apache developers say they do not call erealloc. At this point (to me) it's not clear whether this is a PHP or an Apache bug, but it's definitely related to both.
 [2006-12-23 02:49 UTC] vst at gamervision dot net
OS: Windows XP Pro and Server 2003
PHP: 4.4.4
Apache: 2.23
CPU: AMD X2 4400+
RAM: 2GB DDR

I have the same issue and consider it as CRITICAL. I tried it on many Windows systems and the same results. If I add 'Win32DisableAcceptEx' then I'm getting this issue. But I must use 'Win32DisableAcceptEx' because without it I'm getting some Winsock issues. I can't upgrade to PHP 5 because some of the parts in my side having MySQL connection issues with PHP 5. 

PLEASE!! PLEASE FIX IT ALREADY!!
 [2007-02-02 01:42 UTC] bob at cave dot net
This is not just an apache problem. I am using WebSite Pro under win2000 with php 4.x and get the same error. The website service dies, and the watchdog needs to restart it.
 [2007-05-02 09:14 UTC] niteman dot es at gmail dot com
I had a Windows 2003 with apache 2.0.59 and php 5.0.5 (the machine was an Athlon 2800+ with 1GB of RAM) working fine.

Since I needed more power for my web, I migrated the whole thing with the same configuration to a Dual Core AMD Opteron 1212 HE with 2GB of RAM and this issue started to happen.

I think this could be related with the multiprocesor implementation over windows 2003, but it has a quite inconsistent behaviour (I couldn't reproduce the bug at my will).

Right now I have switched from loading php as a module of apache to the traditional cgi aproach. I'll follow up the issue and post a comment both if the issue is fixed with the change or if it is not.

No doubt to contact me if you need further testing on this.

Sorry for my bad english.

Kind Regards
 [2007-06-11 17:04 UTC] dvlp1024 at hotmail dot com
I having the same problem, but in my case, apache works fine, but with no previous notice i have a "cannot show this page". 
In the log of the apache i have this message

FATAL:  erealloc():  Unable to allocate xxxxx bytes

And in the php log i dont have relevant info of the problem.

Zero
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 17:01:32 2024 UTC