René Leboeuf wrote:
Hi. I'm running a large website. I have some mailing scripts that take days to run. I noticed these scripts slow down with time, sometimes going to an almost complete stop (no mail sent for several minutes). The source code is trivial and can't contain a loop. I monitored the memory usage and couldn't find a memory leak. Using APD, most of the time is reported to be spent in the fgets() function (script waiting for a sendmail reply). But sendmail still replies swiftly when this problem occurs.
By this, I guesss you mean that other connections to sendmail reply swiftly: so the server is not just jamming up completely and refusing requests ?
It might depend on the exact implementation of 'sendmail': for example, the Courier mail system which I use replaces the program 'sendmail' with it's own binary to do the job. Courier also has a 'tar-pitting' feature which is triggered by behaviour that looks like a spammer is trying to relay stuff: it atificially slows the response to the send requests if there is an unreasonably high rate of requests coming from a given source. At least that's how I understand the feature to work. Other mail system may implement a similar feature - it might just be that your mailing script looks like a spam engine to the mail server.
Restarting sendmail has no effect on these scripts. Restarting the scripts makes them run like hell for some hours, until the problem rises again. I'm using PHP 5.2.5 I don't know where to look next for the source of this problem...
I think you need to provide some more detail - you could start by explaining what method you use to send the messages. The next thing to do is to look at the mail logs and see if there are any messages written around the time that yourt script runs. Don't always assume that it is your code that is wrong (that's what managers are for)
-- Peter Ford phone: 01580 893333 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php