LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-28-2005, 07:53 PM   #1
Chowroc
Member
 
Registered: Dec 2004
Posts: 145

Rep: Reputation: 15
Postfix: deferred mails 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 report "lost connection"?

---------------------------------

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: mail pile up? Chowroc Linux - Software 1 12-28-2005 05:34 AM
Problem Deleting E-mails With Postfix xauron Linux - Networking 1 11-18-2004 08:25 AM
postfix, storing mails? Emanon Linux - Networking 2 08-21-2004 06:29 PM
get mails only when requested with fetchmail/postfix rudolfpolzer Linux - Networking 0 03-27-2004 08:27 AM
Postfix don't delivere mails to root mavinac Linux - Software 1 11-23-2003 05:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:11 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