![为什么 Exim 的“sendmail”在发送任何邮件之前大约 5 秒钟似乎什么都不做?](https://linux22.com/image/608087/%E4%B8%BA%E4%BB%80%E4%B9%88%20Exim%20%E7%9A%84%E2%80%9Csendmail%E2%80%9D%E5%9C%A8%E5%8F%91%E9%80%81%E4%BB%BB%E4%BD%95%E9%82%AE%E4%BB%B6%E4%B9%8B%E5%89%8D%E5%A4%A7%E7%BA%A6%205%20%E7%A7%92%E9%92%9F%E4%BC%BC%E4%B9%8E%E4%BB%80%E4%B9%88%E9%83%BD%E4%B8%8D%E5%81%9A%EF%BC%9F.png)
我遇到了一个问题,调用“sendmail”会导致它停留在那里大约 5 秒钟,然后才执行任何操作。我尝试使用“-d”调用它,这是输出:
# sendmail -d [My email] <testmail
Exim version 4.76 uid=0 gid=0 pid=3711 D=fbb95cfd
Berkeley DB: Berkeley DB 5.1.25: (January 28, 2011)
Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb dsearch nis nis0 passwd
Authenticators: cram_md5 plaintext
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
Compiler: GCC [4.6.3]
Library version: GnuTLS: Compile: 2.12.14
Runtime: 2.12.14
Library version: PCRE: Compile: 8.12
Runtime: 8.12 2011-01-15
Total 12 lookups
WHITELIST_D_MACROS: "OUTGOING"
TRUSTED_CONFIG_LIST: "/etc/exim4/trusted_configs"
changed uid/gid: forcing real = effective
uid=0 gid=0 pid=3711
auxiliary group list: <none>
seeking password data for user "uucp": cache not available
getpwnam() succeeded uid=10 gid=10
然后它会停留 5 到 10 秒,不做任何事,然后继续。
configuration file is /var/lib/exim4/config.autogenerated
log selectors = 00000ffc 00612001
cwd=/root 3 args: sendmail -d [My email]
...etc
这段时间它在做什么?我该如何让它停止?令人沮丧的是,指定“-odb”让它在后台运行不是解决问题 - 它的背景后延时。
我在 Ubuntu Server 12.04 上运行 Exim 4.76。Exim 配置为通过智能主机发送所有电子邮件。
以下是 strace 的输出:
getpwnam() succeeded uid=10 gid=10
open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 4
open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 4
open("/etc/host.conf", O_RDONLY|O_CLOEXEC) = 4
open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 4
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 4
open("/lib/x86_64-linux-gnu/libnss_dns.so.2", O_RDONLY|O_CLOEXEC) = 4
open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 4
configuration file is /var/lib/exim4/config.autogenerated
“libnss_dns.so.2”行是延迟之前打印的最后一行。
答案1
Tonny 在评论中回答 - 第一个 DNS 服务器无效,因此它正在等待超时。删除无效的 DNS 条目解决了该问题。