From: Richard Cooper on
Hi All,

I'm using postfix as an MX server which delivers email to the final recipient using virtual aliases. The version number according to rpm is postfix-2.3.3-2.1.el5_2, that is the version which is supplied in the main CentOS5 yum repositories. This is working perfectly except for one problem. Occasionally postfix will reject an email with the following error:

Feb 12 00:41:24 mail1 postfix/smtpd[24782]: NOQUEUE: reject: RCPT from unknown[111.111.111.111]: 550 5.1.1 <recipient(a)example.com>: Recipient address rejected: User unknown in virtual alias table; from=<sender(a)example.net> to=< recipient(a)example.com > proto=SMTP helo=<example.org>

This is a very intermittent and short lived error. Emails to recipient(a)example.com were working before the error and start working again a few seconds after it.

Based on my debugging it seems that this error is related to me running postmap to rebuild the virtual_alias table This is despite the fact that the recipient(a)example.com address is correctly configured in both the old and new virtual_aliases. Here a log of what was happening at the same time as the above error:

2010-02-12 00:40:39,345 - 24597 - DEBUG - Writing virtual_aliases and virtual_domains
2010-02-12 00:41:20,496 - 24597 - DEBUG - Done writing virtual_aliases and virtual_domains.
2010-02-12 00:41:20,506 - 24597 - DEBUG - Running postmap virtual_domains.
2010-02-12 00:41:23,555 - 24597 - DEBUG - Done running postmap virtual_domains.
2010-02-12 00:41:23,556 - 24597 - DEBUG - Running postmap virtual_aliases.
2010-02-12 00:41:24,107 - 24597 - DEBUG - Done running postmap virtual_aliases.

Maillog doesn't have millisecond precision so I can't see exactly when the "User unknown in virtual alias table" error was logged but it happens either while "postmap virtual_aliases" is running or very shortly (within a second) afterwards. The same pattern repeats itself in other cases of the same error. The error always seem to happen within a second or so of "postmap virtual_aliases" finishing.

So my questions are:

1. Does my analysis seem correct?
2. Is this a known problem? Are there any known race conditions in reloading the virtual aliases config by running "postmap virtual_aliases"
3. Is there anyway I can fix or work around this problem? Would upgrading help?
4. If I switched to using a SQL or LDAP backend for the table lookups would this problem go away?

Thanks in advance,

- Richard
From: Eray Aslan on
On 12.02.2010 13:25, Richard Cooper wrote:
> Feb 12 00:41:24 mail1 postfix/smtpd[24782]: NOQUEUE: reject: RCPT from unknown[111.111.111.111]: 550 5.1.1 <recipient(a)example.com>: Recipient address rejected: User unknown in virtual alias table; from=<sender(a)example.net> to=< recipient(a)example.com > proto=SMTP helo=<example.org>
>
> This is a very intermittent and short lived error. Emails to recipient(a)example.com were working before the error and start working again a few seconds after it.

http://www.postfix.org/DATABASE_README.html#safe_db

--
Eray

From: LuKreme on
On 12-Feb-2010, at 04:25, Richard Cooper wrote:
>
> to=< recipient(a)example.com > proto=SMTP helo=<example.org>
>
> This is a very intermittent and short lived error. Emails to recipient(a)example.com were working before the error and start working again a few seconds after it.

The email is not to recipient(a)example.com, it is to " recipient(a)example.com"

Didn't we just cover this in the last week?

--
"I've just learned about his illness. Let's hope it's nothing
trivial." Irvin S. Cobb

From: Richard Cooper on

On 12 Feb 2010, at 12:12, Eray Aslan wrote:

> On 12.02.2010 13:25, Richard Cooper wrote:
>> Feb 12 00:41:24 mail1 postfix/smtpd[24782]: NOQUEUE: reject: RCPT from unknown[111.111.111.111]: 550 5.1.1 <recipient(a)example.com>: Recipient address rejected: User unknown in virtual alias table; from=<sender(a)example.net> to=< recipient(a)example.com > proto=SMTP helo=<example.org>
>>
>> This is a very intermittent and short lived error. Emails to recipient(a)example.com were working before the error and start working again a few seconds after it.
>
> http://www.postfix.org/DATABASE_README.html#safe_db


I'm not sure that apples to my case. That page says "If the update fails in the middle [because the disk is full or because something else happens] then you have no usable database, and Postfix will stop working". In my case the update completes without error, correctly writes virtual_aliases.db and postfix continues working. The only visible error is that during the update Postfix "forgets" some of the lookup table for a short period of time.

None the less, it's a good suggestion for the next thing for me to test. I will give it a try and see if it fixes the problem. Thank you.

- Richard

PS: Apologies to Eray for the off-list reply
From: Richard Cooper on

On 12 Feb 2010, at 12:21, LuKreme wrote:
> On 12-Feb-2010, at 04:25, Richard Cooper wrote:
>>
>> to=< recipient(a)example.com > proto=SMTP helo=<example.org>
>>
>> This is a very intermittent and short lived error. Emails to recipient(a)example.com were working before the error and start working again a few seconds after it.
>
> The email is not to recipient(a)example.com, it is to " recipient(a)example.com"

Sorry. That was a typo I introduced while anonymizing. There were no extraneous spaces in the original.

- Richard

PS: Apologies to LuKreme for the off-list reply