Solved

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

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

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!

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 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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 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