LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-24-2005, 12:32 AM   #1
Chowroc
Member
 
Registered: Dec 2004
Posts: 145

Rep: Reputation: 15
Postfix: mail pile up?


I found that when the number of deferred messages grow, postfix qmgr is prone to "pile up" the mails and active them all at once. Since I have control the rate and connection features like this:
Code:
initial_destination_concurrency = 1
default_destination_concurrency_limit = 1
smtp_destination_concurrency_limit = 1
in_flow_delay = 3s
default_process_limit = 80
maximal_queue_lifetime = 10d

# smtp_connection_cache_reuse_limit = 5s
smtp_connection_cache_reuse_limit = 5
smtp_connection_cache_time_limit = 1s
smtp_connection_cache_on_demand = no
smtp_connection_cache_destinations = sina.com
The 1st section limit to 20 mails/min to a destination, because most large site such as 163, yahoo, sina, sohu ... ask for this, otherwise many mails will be bounced while the mail was generated by a PHP program(to send confirm mails to registered users); and the 2nd makes the smtp process not reuse the connections, otherwise some site will bounce the mail with "too many letters during this connections".

But when mails to some site such as sina.com was not fast, these mails start to be deferred, at last I found in the maillog that qmgr active all of these mails just in several seconds.
Code:
Nov 22 09:43:17 PTZXMAIL postfix/qmgr[12331]: 7FEE6A2A034: to=<xxxx@sina.com>, relay=none, delay=474849, status=deferred (delivery temporarily suspended: lost connection with sinamx.sina.com.cn[202.108.3.187] while sending DATA command)
Just in this one second, I have found 225 such records, the most I have found is that 4700 records during maybe 4~5s.

Since I have limit the rate to a destination, why still postfix do this?

What about the defers between smtp & qmgr? since qmgr just manage the queue, why does it reposrt "lost connection"?

Thanks.

Last edited by Chowroc; 12-28-2005 at 05:25 AM.
 
Old 12-28-2005, 05:34 AM   #2
Chowroc
Member
 
Registered: Dec 2004
Posts: 145

Original Poster
Rep: Reputation: 15
So far, I can only solve this problem with a temporary way: Just put all these mails to the hold queue, and then fetch them to requeue one by one. Below is a short script to do so:
Code:
#!/bin/sh

_sites=$@
_basetime=120
_offset=120

>sites.txt

for site in $_sites; do
        echo $site

        mailq \
        | awk "BEGIN{RS=\"\"; FS=\"(\n| *)\"} {if(\$NF~/@$site/) print \$1}" \
        | grep -v '!' \
        | sed 's/\*$//g' >tmp

        cat tmp | while read msg_id; do postsuper -h $msg_id; done

        mailq \
        | awk "BEGIN{RS=\"\"; FS=\"(\n| *)\"} {if(\$NF~/@$site/) print \$1}" \
        | grep '\!' \
        | sed 's/\!$//g' \
        | sort >>sites.txt
        # to avoid overriding this operations before!
done

sort sites.txt >tmp
cp -f tmp sites.txt

cat sites.txt | while read msg_id; do
        postsuper -r $msg_id;
        r=`echo "" | awk "{srand(); print int(rand()*$_offset+$_basetime)}"`
        sleep $r;
done
But I don't think it's a good idea, I want to find the way that makes the postfix solve this problem itself. Is there any one can help me?

Thanks.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix send mail problem(In RH9, kernal 2.4.20, postfix 2.1.5) minor Linux - General 6 09-23-2019 10:09 PM
Postfix mail transfer agent not sending mail locally or to other servers sketelsen Linux - Software 3 02-09-2006 11:16 AM
problem receiving pop3 mail from postfix mail server GEN_Electric Linux - Software 2 02-14-2005 02:43 PM
Postfix $HOME/mail/inbox instead of /var/spool/mail ramram29 Linux - Software 3 08-08-2004 01:28 AM
Postfix mail server not accepting incoming mail from the external interface rexmundi Linux - Networking 7 12-22-2003 03:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration