Forum OpenACS Q&A: couldn't fork child process: not enough memory

Hi all,

After 3 days of uptime my OpenACS installation starts to get the following error whenever acs_mail_lite calls sendmail:

couldn't fork child process: not enough memory

The sweeper proc does not check to see if the delivery was successfull and the email is removed from the queue.

After a restart the service runs properly for another 3 days. Would using the "SMTP" method of sending email or replacing sendmail calls with ns_sendmail (Don's suggestion) alleviate this problem?

I am using Tcl 8.3.5 with AolServer 4.0.10 on the latest version of OpenACS.

Collapse
Posted by Dave Bauer on
Alex

Just restart AOLserver nightly.

That is what we do on OpenACS.org that has the same issue.

Collapse
Posted by Richard Hamilton on
Presumably that is caused by a memory leak, or alternatively threads not terminating and releasing allocate memory.

I have been using a modified version of ns_sendmail for sending outgoing mail for about four years and have not seen this issue.

Regards
Richard

Collapse
Posted by Patrick Giagnocavo on
You should check the amount of swap you have configured, and the size of the AOLserver process.

Use "vmstat 5" and look at the swap usage and amount of free RAM numbers.

Collapse
Posted by Alex Kroman on
Dave - Restarting Aolserver nightly solves the problem for now.

Richard - Did you simply replace calls to sendmail with ns_sendmail in acs_mail_lite? Have you run into any issues using ns_sendmail?

Collapse
Posted by Malte Sussdorff on
Don't use sendmail binary. It is slow. Use SMTP. And once you install TclLIB and want to be fancy take a look at the latest version of acs-mail-lite on HEAD. It allows you to define the SMTP parameters as ACS Parameters, allowing you to change mailservers on the fly in case your primary mailserver goes down. This is with username and password, so feel free to hammer against your E-Mail service provider and give them a hard time (just kidding). Currently it only supports complex send but obviously you could just copy past to ::smtp
Collapse
Posted by Gustaf Neumann on
Alex,

doing an exec in a process with a large footprint can be expensive (doubling the footprint in the worst case, but that depends on the used operating system). The footprint of nsd is the sum of the memory all nsd threads. To reduce the footprint, i would recommend to reduce the number of connection threads and use bg-delivery for large file deliveries
http://www.openacs.org/xowiki/en/Boost_you_application_performance_to_serve_large_files%21

Furthermore, i would recommend to switch to a recent version of tcl (such as 8.4.13). Several memory and thread related problems were fixed in tcl during the last four years.

Another option to address the fork problem is to use ns_proxy, which should be better in this respect.

Collapse
Posted by Alex Kroman on
Thanks for all the great suggestions! I think I finally understand what's going on now. Tons of active threads with hundreds of emails being sent out don't make for a very happy server. For now I'm going to try using OpenACS's built in SMTP method. If that doesn't prove to be as robust as what I need I'll implement Gustaf's suggestions.