Solved

httpd errorlog questions

Posted on 2006-11-08
8
1,087 Views
Last Modified: 2011-04-14
Hello,

I've serached the internet to get some more info about the following errors/warns:

-------
FATAL:  erealloc():  Unable to allocate 3932160 bytes
FATAL:  erealloc():  Unable to allocate FATAL:  erealloc():  Unable to allocate [Tue Nov 07 12:45:02 2006] [error] (12)Cannot allocate memory: fork: Unable to fork new process
-------
[Mon Nov 06 15:41:11 2006] [error] (23)Too many open files in system: apr_accept: (client socket)
-------
[Thu Nov 02 12:50:42 2006] [warn] child process 8126 still did not exit, sending a SIGTERM
-------

These errors come back, sometimes stopping the server, but not always.
What's the reason for these errors? What can we do about it?
We host a Virtual private server with apollohosting.

Here is some server info (httpf.conf)
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule prefork.c>
StartServers 2
MinSpareServers 5
MaxSpareServers 10
MaxClients 100
MaxRequestsPerChild  1000
</IfModule>

<IfModule worker.c>
StartServers 2
MaxClients 100
MinSpareThreads      1
MaxSpareThreads      4
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

We've played a bit with these values but so far with no succes. How can I look on the server how many CPU usage we have? (Using putty, I can see the total cpu usage, but not for our VPS)

Thanks,
Dirkvu
0
Comment
Question by:dirkvu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 6

Expert Comment

by:bpeterse
ID: 17902334
in httpd.conf there are the following settings that are off by default.  Set these as follows:

ExtendedStatus On

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from <your_ip_address>
</Location>

Restart your httpd daemon and access your apache server in a browser with "http://<my_web_server/server-status" and you should have a good bit o'information to look at.

BTW - if you read the comments in your httpd.conf, most of your settings are best left alone to start with and then tweak <conservatively> as the need arises.  With respect to your error message you posted, see the following note from httpd.conf:
***********************
# MaxRequestsPerChild: the number of requests each child process is
# allowed to process before the child dies.  The child will exit so
# as to avoid problems after prolonged use when Apache (and maybe the
# libraries it uses) leak memory or other resources.  On most systems, this
# isn't really needed, but a few (such as Solaris) do have notable leaks
# in the libraries. For these platforms, set to something like 10000
# or so; a setting of 0 means unlimited.
**************************
It appears you've changed your 'MaxRequestsPerChild' to 1000 instead of the default 0 and now your system is compalining about it.  Change all your settings back to the default, get it working with the server-status and change from that point forward, one setting at a time.
0
 
LVL 57

Expert Comment

by:giltjr
ID: 17903767
Umm, according to the Apache web site the default for MaxRequestsPerChild is 10,000, not 0.  At least for 2.0.

How much memory do you have on the box.  

--> FATAL:  erealloc():  Unable to allocate 3932160 bytes

Indicates that Apache failed to allocate just under 4MB of memory.

--> FATAL:  erealloc():  Unable to allocate FATAL:  erealloc():  Unable to allocate [Tue Nov 07 12:45:02 2006] [error] (12)Cannot allocate memory: fork: Unable to fork new process

Indicates that Apache was attemping to fork a new process, but because it could not allocate any memory it could not start the new process.

--> [Mon Nov 06 15:41:11 2006] [error] (23)Too many open files in system: apr_accept: (client socket)

Seems to indcate that it can't can't open a new socket connection.
0
 
LVL 6

Expert Comment

by:bpeterse
ID: 17906331
> Umm, according to the Apache web site the default for MaxRequestsPerChild is 10,000, not 0.

Right out of the httpd.conf from 1.3.19 - read last 2 lines please....

# MaxRequestsPerChild: the number of requests each child process is
# allowed to process before the child dies.  The child will exit so
# as to avoid problems after prolonged use when Apache (and maybe the
# libraries it uses) leak memory or other resources.  On most systems, this
# isn't really needed, but a few (such as Solaris) do have notable leaks
# in the libraries. For these platforms, set to something like 10000
# or so; a setting of 0 means unlimited.

Getting memory errors about unable to fork new process - easy to set it back to 0 (i.e. unlimited) and check if the error stops.  Easy troubleshooting step.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 57

Accepted Solution

by:
giltjr earned 125 total points
ID: 17910536
The comments do not indicate what the default is.  However I did check the doc and for 1.3 the default was 0.  However, Apache changed this with 2.0 and 2.2:

http://httpd.apache.org/docs/2.0/mod/mpm_common.html#maxrequestsperchild

http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxrequestsperchild


--> Getting memory errors about unable to fork new process - easy to set it back to 0 (i.e. unlimited) and check if the error stops.  Easy troubleshooting step.

If he is running 1.3, then changing it to 0 will be changing it back to the defualt.  However if he is running 2.0 or 2.2, changing it to 0 will not change it back to the default.

I am also confused on how you think this will help.  The problem seems to be there is not enough memory to fork a new process.  How is this related to how many requests a child will handle before shutting itself down?  If there is a memory leak, the changing this to 0 could make the problem worse and the child processes will never end.  If there is not a memory leak, it could mean that he is attempting to fork new processes and he just does not have the memory.
0
 
LVL 6

Expert Comment

by:bpeterse
ID: 17910915
giltjr

I'm just trying to help the poster with what I see as a possible problem.  If you see something more compelling, please make your case without condescension, picking apart others' help or trying to put them on the defensive.  
0
 
LVL 57

Expert Comment

by:giltjr
ID: 17911417
I am sorry if it seems like I am attempting to pick apart your suggestions.  

I was pointing out that fact that the default for MaxRequestsPerChild has changed since V1.3.

I am also attempting to learn your thought process of why you you beleive that changing MaxRequestsPerChild from 1000 to 0 will either help prevent or diagnose the problem.  Based on how I am interperting the error, it does not make sense to me.  So I would like to try and understand your reasoning to help me learn.
0
 

Author Comment

by:dirkvu
ID: 17920832
Thanks for the answers! I've changed the settings to the defaults (according to the docs (apache 2.0)

<IfModule prefork.c>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 256
MaxRequestsPerChild  10000
</IfModule>


<IfModule worker.c>
StartServers 3
MaxClients 150
MinSpareThreads      25
MaxSpareThreads      75
ThreadsPerChild     25
MaxRequestsPerChild  10000
</IfModule>

------------
bpeterse, I've tried the my_web_server/server-status, but I have no permission to see that page. Maybe because it is a Virtual Private Server?


------------
giltjr ==>
--> FATAL:  erealloc():  Unable to allocate 3932160 bytes
Indicates that Apache failed to allocate just under 4MB of memory.

This error also comes on with lower and higher values. Is this RAM memory? How can I see how much RAM I have (remember, It's a VPS!). Can I increase my swap memory?

------------
giltjr ==>
--> [Mon Nov 06 15:41:11 2006] [error] (23)Too many open files in system: apr_accept: (client socket)
Seems to indcate that it can't can't open a new socket connection.

ok, good to know, but what can I do about it?



Does anyone know a good apache manual on the internet? And I don't mean the apache documentations. A good manual that explains most important things in an easy way.

thanks,
dirkvu
0
 
LVL 57

Expert Comment

by:giltjr
ID: 17921753
The memory is the total of RAM+swap file(s) size.  You could increase the size of your swap file, or add a new swap file.

However, you need to see how much memory you have.  If you are using considerably more memory that your have RAM, your system will slow down as it must constantly move things out of RAM to the swap file and then from the swap file back into RAM.  It sounds as if you may not have enough RAM to do what you want, or you have seriously under sized your swap file(s).

There are a couple of possibilities on the too many open files.  One is that because Apache can't fork a new process it can't open a new socket to support the new connection.  Another is that you have way too much traffic for this sever.

I would suggest that your focus on the memory issue first.  Then if the 'too many open files" issue still exists, start looking at it in more detail.

Are you just doing static web page serving?  Are you doing any sever side scripting?  Are you running a database o the same box?  What size box do you have?  How many concurrent user do you normally expect to have?  How many concurrent users do you have?  All of these are question you need too look at as they will help you see if your box is undersized.  You can't expect to support 100 concurrent user using dynamic HTML with sever side scripting with a database all the same box and that box be a old Pentium 500 Mhz with 128 MB of RAM and no swap file.  But you could expect a Dual or Quad Xeon with 2GB of RAM and 2+GB of swap to handle it.

You may want to do a search for "Tuning Apache" in a search engine.  I have learned by reading the Apache doc, reading other forums and information on the the Internet, taking guesses (and being wrong a lot).
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question