linux/redhat: mailing list (sendmail) hangs after approx. 5 min running
Posted on 2004-10-05
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.