Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am running apache on Fedora with mod_perl. The server forks a process to send an email frequently - and the fork exits.

Suddenly, I got: Cannot fork: Cannot allocate memory. There was plenty of free memory (I did not look too closely, but there was more memory free than in use), not too many apache processes running - 10?, low cpu usage, close to 0. Restarting the server httpd graceful resolved the issue.

What would cause something like this? Is it possible that I got into some kind of a state where the problem was allocating too many processes in the system - and with dropping load failed to recover?

Unfortunately I do not have too much info as I was panicking and trying to get the site up instead of running diagnostics. :-) So my question is very general: is there anything that's not obvious that would create this behavior when too many processes are allocated? Anything specific to forking from within apache? etc

Thank you!

share|improve this question
    
can you be more precise about this ? how much is "plenty of free memory" ? how much is "not too many processes running" ? Did you run an htop-like tool to see what consumes most of the memory ? –  Coren Feb 18 '12 at 10:42
    
Yes, can you be also generous in sharing your apache config (mostly performance tuning specific) –  Nikhil Mulley Feb 19 '12 at 6:58
    
can you provide the output of sysctl -a 2>/dev/null | grep '^vm' and cat /proc/meminfo. Preferably while the issue is occurring. If this is not possible, still post, there may be something blatantly obvious. –  Patrick Feb 25 '12 at 4:32
    
Are you running this on any virtual machine? I have a similar problem, although with another software. –  Barun Mar 2 '12 at 6:16
add comment

1 Answer

It sounds like you are hitting resource limits. Look at pam_limits.so and /etc/security/limits.conf. These allow an administrator to set explicit limits on the resources a user can use so that one user can't hog all the system resources. If Apache is hitting a limited specified by this, it will return an error like above even though there are plenty of resources other users can use. There is also the limit or ulimit command in most shells, but I don't think that's the problem.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.