Very slow exim mailq with empty queue

eximtimeout

I'm having a rather strange problem with exim mailq command (or the equivalent exim -bp or exim -bpc). My mail queue is empty, yet it takes around 1 minute (or more) for the command to return…

$ time mailq
real    0m50.803s
user    0m0.040s
sys     0m0.040s


time exim4 -bpc
0

real    1m24.697s
user    0m0.000s
sys 0m0.300s

I tried to check a few things:

  1. nothing special in /var/log/exim4/mainlog; paniclog is empty
  2. Nothing blocked on firewall
  3. /etc/resolv.conf seems ok, name resolution works fine
  4. /etc/hosts, /etc/hostname and /etc/mailname all seem fine (correct name/ip)
  5. Nothing special in /var/log/syslog or /var/log/messages or /var/log/kern.log

Does anyone have some similar experience or any other suggestions where the problem might be?

Best Answer

The mailq command needs to read the on-disk mail queues; try running iostat or dstat in a second terminal while executing the command, if it shows much disk I/O then you have a disk or filesystem bottleneck.