?
Solved

linux/redhat: mailing list (sendmail) hangs after approx. 5 min running

Posted on 2004-10-05
3
Medium Priority
?
235 Views
Last Modified: 2010-04-22
Configuration:
Operating System: RedHat 7.2
Processor: Athlon XP 1800+
RAM: 512 MB
Hard Drive: 60 GB IDE
Bandwidth: 500 GB

I have a php mailing list manager that loops through a send routine, picks email addresses from a MySQL db and sends the message to each one. I have a problem where it will send to approx the first 1000 addresses then just stop, leaving the other 1000 or so address in the send que. The time it runs is approx. 5 min before it stops.

To do some testing, I commented out the sendmail lines and instead piped the output to a log file. The routine completed without a problem. I checked the time limit in the php_ini file that limits the time a script can run, and that doesn't seem to be the problem either. The log-to-file test ran for about 10 min without stopping.

My theory: The script hangs because the script is feeding commands to the system faster than sendmail can actually send, so memory is filling up and it just quits after a certain point. So, the issues has to do with memory or the buffer somehow. Maybe I need more than 500 megs of ram for this to work. That's my best guess.

Possible fix: Send in chunks of 50 every x seconds, and give the system time to "catch up" before sending more.

Note: In actual timing tests, it sends 10 per sec with mail(), and 12 per sec using the raw socket to send.
0
Comment
Question by:arievandenberg
[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
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 2000 total points
ID: 12233063
You might  be feeding messages to sendmail fast enough to reach a load average where it ceases to attempt immediate delivery (QueueLA which defaults to 8). The second limit is the load average at which Sendmail stops accepting SMTP connections (RefuseLA which defaults to 12).

The simple solution to this is to throttle the rate of message submission by placing a wait of some seconds in between each message submission. The more complex and smarter way is to monitor the mail queue depth and load average and submit messages at a rate that keeps both within reasonable limits.
0
 

Author Comment

by:arievandenberg
ID: 12259396
I think this will get me on the right path to correct the issue. I won't have a chance to test this for a while. In terms of monitoring the queue depth, is there a php routine that can do this. If so, I could probably do an if...then statement within the send routine. Thanks.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12259905
I don't know of any "off-the-shelf" routines for doing this. When I've needed this in the past I've done it by writing a Perl script that does whatever checks I want and returns a count of permissible messages (0-n). Then I call that via system() in the PHP code. The php code can then use the returned count as the messages to queue up. Since the mail queue is only accessable by root on most modern system doing the work in an external script or progam allows that external tool to be suid to root without undue risk.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
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: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

770 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