Solved

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

Posted on 2004-10-05
3
234 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 500 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

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

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

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…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

724 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