421 communication network_error ai_generated partial

421 4.7.0 Service not available, closing transmission channel

ID: communication/smtp-421-service-not-available

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
1Evidence
2024-01-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Postfix 3.8.0 active
Sendmail 8.17.1 active
Exim 4.96 active
Microsoft Exchange 2019 active
Amazon SES SMTP endpoint active

Root Cause

SMTP server rejects connection due to temporary resource exhaustion (e.g., too many concurrent connections, rate limiting, or DNS lookup failures) as defined in RFC 5321 section 4.2.5.

generic

中文

SMTP服务器因临时资源耗尽(如并发连接过多、速率限制或DNS查找失败)而拒绝连接,如RFC 5321第4.2.5节所定义。

Official Documentation

https://www.rfc-editor.org/rfc/rfc5321#section-4.2.5

Workarounds

  1. 85% success Implement exponential backoff retry in the SMTP client: after receiving 421, wait 30 seconds, then 60, then 120, etc., up to a max of 5 retries.
    Implement exponential backoff retry in the SMTP client: after receiving 421, wait 30 seconds, then 60, then 120, etc., up to a max of 5 retries.
  2. 80% success Reduce the number of concurrent SMTP connections from your application by adding a connection pool with a max limit (e.g., 10 connections).
    Reduce the number of concurrent SMTP connections from your application by adding a connection pool with a max limit (e.g., 10 connections).
  3. 75% success Check the SMTP server logs for 'too many connections' and adjust the 'smtpd_client_connection_count_limit' in Postfix (default 50) to a higher value like 100.
    Check the SMTP server logs for 'too many connections' and adjust the 'smtpd_client_connection_count_limit' in Postfix (default 50) to a higher value like 100.

中文步骤

  1. Implement exponential backoff retry in the SMTP client: after receiving 421, wait 30 seconds, then 60, then 120, etc., up to a max of 5 retries.
  2. Reduce the number of concurrent SMTP connections from your application by adding a connection pool with a max limit (e.g., 10 connections).
  3. Check the SMTP server logs for 'too many connections' and adjust the 'smtpd_client_connection_count_limit' in Postfix (default 50) to a higher value like 100.

Dead Ends

Common approaches that don't work:

  1. Disable rate limiting on the SMTP server entirely 95% fail

    Disabling rate limiting removes protection against spam and DoS attacks; it may cause the server to crash or be blacklisted.

  2. Increase the SMTP server's max message size 85% fail

    The 421 error is not about message size but about resource availability; increasing message size can exacerbate the resource issue.

  3. Use a different SMTP port (e.g., 587 instead of 25) 70% fail

    Port 587 is for message submission and may have different rate limits, but the underlying resource exhaustion on the server remains unchanged.