You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Noel J. Bergman" <no...@devtech.com> on 2003/06/18 19:37:54 UTC
Improving temporary failure handling in RemoteDelivery
In RemoteDelivery, we have the following:
// This was not a connection or I/O error particular to one
// SMTP server of an MX set. Instead, it is almost certainly
// a protocol level error. In this case we assume that this
// is an error we'd encounter with any of the SMTP servers
// associated with this MX record, and we pass the exception
// to the code in the outer block that determines its severity.
throw me;
This is when handling a MessagingException that is not SendFailedException
during an SMTP transaction. I just encountered one of these with:
RemoteDelivery: Exception delivering message (Mailxxx) - 451 4.7.1 Please
try again later
RemoteDelivery: Temporary exception delivering mail (Mailxxx:
javax.mail.MessagingException: 451 4.7.1 Please try again later
This was a temporary outage for 1 of 3 primary, 2 secondary, 1 tertiary, and
1 quaternary mail servers, i.e., 1 out of 7 possible servers. It seems to
me that James should try the others in the case of a temporary exception,
e.g.,
if (ex.getMessage() != null && '4' == ex.getMessage().trim().charAt(0)) {
// best guess at a temporary failure
lastError = me;
continue;
} else {
throw me;
}
Comments?
--- Ne
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org
Re: Improving temporary failure handling in RemoteDelivery
Posted by Serge Knystautas <se...@lokitech.com>.
Noel J. Bergman wrote:
> Serge,
>
> The particular error I received:
>
> 451 4.7.1 Please try again later
Well, per your analysis of that response, you've got multiple
conflicting rules. 451 says local error, 4.7.1 says could be either,
the note on the error says try again later, and 4.7.1 says this should
be a permanent error.
I've got a nice shiny quarter here... you want to call heads or tails?
--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org
RE: Improving temporary failure handling in RemoteDelivery
Posted by Jason Webb <jw...@inovem.com>.
<snip'd>
>
> But getting back to RFC 2821, here are its descriptions for
> the 4xx codes:
>
> 421 <domain> Service not available, closing transmission channel
> (This may be a reply to any command if the service knows it
> must shut down)
> 450 Requested mail action not taken: mailbox unavailable
> (e.g., mailbox busy)
> 451 Requested action aborted: local error in processing
> 452 Requested action not taken: insufficient system storage
>
> Based upon that, 421 and 451 imply trying another server, in
> my view. And speaking to the operations center at Road
> Runner, they were quite clear that they expect 451 exceptions
> to cause mail servers to go to the next one. Those are errors
> that are likely to be local to the server. 450 and 452 are
> more debatable, however, I will point out that RFC 2821 #5 says:
>
> When the lookup succeeds, the mapping can result in a list of
> alternative delivery addresses rather than a single
> address, because
> of multiple MX records, multihoming, or both. To provide reliable
> mail transmission, the SMTP client MUST be able to try (and retry)
> each of the relevant addresses in this list in order, until a
> delivery attempt succeeds. However, there MAY also be a
> configurable
> limit on the number of alternate addresses that can be
> tried. In any
> case, the SMTP client SHOULD try at least two addresses.
>
> > To fabricate a case that could justify current behavior,
> say I have a
> > quota on Joe Smith's mailbox at 10 MB. His mailbox is at
> quota, so I
> > don't want to accept more messages for Joe.
>
> That particular example is a mess. The RFC is ambiguous, and
> regardless of what some people might say is correct, the
> unfortunate fact is that some servers reject with 450, some
> with 451, some with 452, and still others with 552. Dreadful.
>
> > Meanwhile, I have a remote backup server that accepts messages when
> > the primary is down. Because it is remote, I can't check whether a
> > mailbox is full, so I don't reject based on the quota.
>
> > Right now our server would see that Joe is overquota, and try again
> > later, until either Joe clears some messages or our retry
> fails. If
> > you change it, you'll deliver to my remote server
>
> And when the backup server is able to deliver to the primary,
> the primary can do the quota checking.
This puts the onus of bouncing the email on the relay.
Not a problem for us, as we have sent the email OK (in theory).
However this does give us problems when the local mail admin is trying
to track a problem,
As the mail to that user always seen to be delivered OK.
I suppose all we have to do is log the fact that transmission
was attempted to a given host for a given mail.
>
> > But I would have preferred Joe's sister never send those 10
> additional
> > 5 MB messages in the first place.
>
> That is why some servers reject a full mailbox with a 552, so
> that the mail is never resent.
>
> > Sorry the lengthiness
>
> Don't be! These are good issues. If I didn't want your
> view, I would't ask (and I wouldn't be here).
>
> > it depends on whether 451 is a reply for the domain
> > or for this server.
On the subject on 451 handling, I think it's a server-only error and you
should try another server.
>
> I agree. It seems to be ambiguous.
>
> > I tried reading through the RFCs, and am only the worse for it. :)
>
> I know. They give me headaches, too.
>
> One thing that we could instead do is change our default
> retry behavior. RFC 2821 recommends "favoring a policy of two
> connection attempts in the first hour", and every few hours
> for at least the next 4-5 days. We default to waiting 6
> hours, and abandon with two days. If we retry sooner, and we
> make sure that the MX records are randomized, it should help.
> I've just committed a change to do randomization, although
> the DNS also does some of that, too.
>
> By the way, RFC 2821 #4.5.4.1 suggests that we change our
> queuing to follow suggestions that we've made earlier. It
> says that if we fail in sending a message to a domain, we
> should not send other messages to that domain until a timeout
> has passed (or we get a message from that domain).
>
> A client SHOULD keep a list of hosts it cannot reach and
> corresponding connection timeouts, rather than just
> retrying queued mail items.
>
> Something for the future queuing model.
It would also fit well with a system of limiting the number of
simultaneous deliveries to a given domain/host.
The ability to do this is critical for large ISPs like AOL etc., as you
can find all your deliveries stalling on the slow AOL mail servers.
I have implemented a very crude method of doing this, so I might add
these features once I've tidied the code up.
>
> --- Noel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org
RE: Improving temporary failure handling in RemoteDelivery
Posted by "Noel J. Bergman" <no...@devtech.com>.
Serge,
The particular error I received:
451 4.7.1 Please try again later
follows RFC 2034 (http://www.ietf.org/rfc/rfc2034), The 451 code is from
RFC 2821, and the 4.7.1 is from RFC 3463
(http://www.ietf.org/rfc/rfc3463.txt), which tries to clean up the SMTP
status code mess. Mind you, the use of 4.7.1 seems wrong, although common
to both qmail and sendmail. The RFC says (in two parts):
4.XXX.XXX Persistent Transient Failure
A persistent transient failure is one in which the message as
sent is valid, but persistence of some temporary condition has
caused abandonment or delay of attempts to send the message.
If this code accompanies a delivery failure report, sending in
the future may be successful.
X.7.1 Delivery not authorized, message refused
The sender is not authorized to send to the destination. This
can be the result of per-host or per-recipient filtering. This
memo does not discuss the merits of any such filtering, but
provides a mechanism to report such. This is useful only as a
permanent error.
But getting back to RFC 2821, here are its descriptions for the 4xx codes:
421 <domain> Service not available, closing transmission channel
(This may be a reply to any command if the service knows it
must shut down)
450 Requested mail action not taken: mailbox unavailable
(e.g., mailbox busy)
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage
Based upon that, 421 and 451 imply trying another server, in my view. And
speaking to the operations center at Road Runner, they were quite clear that
they expect 451 exceptions to cause mail servers to go to the next one.
Those are errors that are likely to be local to the server. 450 and 452 are
more debatable, however, I will point out that RFC 2821 #5 says:
When the lookup succeeds, the mapping can result in a list of
alternative delivery addresses rather than a single address, because
of multiple MX records, multihoming, or both. To provide reliable
mail transmission, the SMTP client MUST be able to try (and retry)
each of the relevant addresses in this list in order, until a
delivery attempt succeeds. However, there MAY also be a configurable
limit on the number of alternate addresses that can be tried. In any
case, the SMTP client SHOULD try at least two addresses.
> To fabricate a case that could justify current behavior, say I have a
> quota on Joe Smith's mailbox at 10 MB. His mailbox is at quota, so I
> don't want to accept more messages for Joe.
That particular example is a mess. The RFC is ambiguous, and regardless of
what some people might say is correct, the unfortunate fact is that some
servers reject with 450, some with 451, some with 452, and still others with
552. Dreadful.
> Meanwhile, I have a remote backup server that accepts messages when the
> primary is down. Because it is remote, I can't check whether a mailbox
> is full, so I don't reject based on the quota.
> Right now our server would see that Joe is overquota, and try again
> later, until either Joe clears some messages or our retry fails. If
> you change it, you'll deliver to my remote server
And when the backup server is able to deliver to the primary, the primary
can do the quota checking.
> But I would have preferred Joe's sister never send those 10
> additional 5 MB messages in the first place.
That is why some servers reject a full mailbox with a 552, so that the mail
is never resent.
> Sorry the lengthiness
Don't be! These are good issues. If I didn't want your view, I would't ask
(and I wouldn't be here).
> it depends on whether 451 is a reply for the domain
> or for this server.
I agree. It seems to be ambiguous.
> I tried reading through the RFCs, and am only the worse for it. :)
I know. They give me headaches, too.
One thing that we could instead do is change our default retry behavior.
RFC 2821 recommends "favoring a policy of two connection attempts in the
first hour", and every few hours for at least the next 4-5 days. We default
to waiting 6 hours, and abandon with two days. If we retry sooner, and we
make sure that the MX records are randomized, it should help. I've just
committed a change to do randomization, although the DNS also does some of
that, too.
By the way, RFC 2821 #4.5.4.1 suggests that we change our queuing to follow
suggestions that we've made earlier. It says that if we fail in sending a
message to a domain, we should not send other messages to that domain until
a timeout has passed (or we get a message from that domain).
A client SHOULD keep a list of hosts it cannot reach and
corresponding connection timeouts, rather than just
retrying queued mail items.
Something for the future queuing model.
--- Noel
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org
Re: Improving temporary failure handling in RemoteDelivery
Posted by Serge Knystautas <se...@lokitech.com>.
Noel J. Bergman wrote:
> RemoteDelivery: Exception delivering message (Mailxxx) - 451 4.7.1 Please
> try again later
What's the RFC say for 451? If it's authoritatively saying you should
try later, then I think the behavior is currently correct.
To fabricate a case that could justify current behavior, say I have a
quota on Joe Smith's mailbox at 10 MB. His mailbox is at quota, so I
don't want to accept more messages for Joe.
Meanwhile, I have a remote backup server that accepts messages when the
primary is down. Because it is remote, I can't check whether a mailbox
is full, so I don't reject based on the quota.
Right now our server would see that Joe is overquota, and try again
later, until either Joe clears some messages or our retry fails. If you
change it, you'll deliver to my remote server, thereby getting around my
rejection on the quota basis. Yes, my remote server will ultimately
figure this out, but I would have preferred Joe's sister never send
those 10 additional 5 MB messages in the first place.
Sorry the lengthiness, but it depends on whether 451 is a reply for the
domain or for this server. I tried reading through the RFCs, and am
only the worse for it. :) I don't see anything that says when you
should move through the MX chain, just that you should and how. My
feeling is if the server gives a response, that's enough for the domain.
Dunno.
--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org