Mail fails to connect often, maybe dovecot issue

Hi

I am having an issue on a server I use to supply email accounts. It is a Centos 6 server, uses Webmin/Virtualmin. Uses Postfix for SMTP and Dovecot for IMAP.

I have this server for years and it has worked fine. But the past month or so it has been playing up and I don't know why.

Frequently email clients would fail to connect. In Thunderbird I often get messages saying it failed to move the message to the Sent or Drafts folder.

Apple Mail shows the warning icon, with message saying The connection to the server “mail.mydomain.co.uk” on port 143 timed out. There may be other similar messages.

If I restart Dovecot it all works OK then.

I initially thought it may be a memory issue so upgraded the server from 8Gb to 16Gb, but it still happens.

I use Roundcube as the webmail tool and that has been having internal server 500 errors or timeout errors for a while, I think it may be related.

I have been trawling the logs to see if there is any indication of why it would fail but cant find anything.

Does anyone have any idea where to start troubleshooting this? Is there a specific log file I should look in that I haven't? I have been looking in /var/log/maillog and /var/log/messages but dont see anything obvious to me.

There is more info on the virtualmin forum https://www.virtualmin.com/node/54062#comment-787752

7 Replies

I have enabled dovecot logs in its conf file, and when it failed again earlier, I found these logs around about that time:

Nov 27 12:03:19 master: Warning: Killed with signal 15 (by pid=7251 uid=0 code=kill)
Nov 27 12:03:19 imap: Info: Server shutting down. bytes=940/3222
Nov 27 12:03:19 imap: Info: Server shutting down. bytes=153/1439
Nov 27 12:03:19 imap: Info: Server shutting down. bytes=255/1111
Nov 27 12:03:19 imap: Info: Server shutting down. bytes=404/1149
Nov 27 12:03:19 imap: Info: Server shutting down. bytes=535/3879
Nov 27 12:03:19 imap: Info: Server shutting down. bytes=1859799/7299

and that list of Server shutting down is very long.

Also found this

Nov 27 12:13:19 master: Warning: service(imap-login): process_limit reached, client connections are being dropped

If I add the following to /etc/dovecot/dovecot.conf

default_process_limit = 2000

I get this warning on restart:

Starting Dovecot Imap: doveconf: Warning: service auth { client_limit=4096 } is lower than required under max. load (6048)
doveconf: Warning: service anvil { client_limit=1000 } is lower than required under max. load (4003)
Warning: service auth { client_limit=4096 } is lower than required under max. load (6048)
Warning: service anvil { client_limit=1000 } is lower than required under max. load (4003)

After playing around with some values on the following, I dont have that error, and have increased the limits, so will monitor if this worked

default_process_limit=500
default_client_limit=1200

How many clients and connections do you have? Bear in mind, Thunderbird has a tendency of opening a connection per every email you are writing, so if your users have the habit of opening two dozen new mail windows, and then copy pasting templates and addresses into them, that's two dozen connections (plus some) to the server. If your load is going into thousands you may consider clustering or at least imapproxy.

To clarify, the suggestion above isn't about performance, as a 8Gb Linode will handle many thousand connections easily; rather it is about reliability (i.e. DNS roundrobin and elevated resource limits so that the whole system still works if one of the servers goes down, plus a separate box for database and mailbox contents)

> How many clients and connections do you have? I dont actually know as it varies. I started to check with this "netstat -an | grep :143 | wc -l" and it reported up to the 70s at the time. I dont know what the maximum is but seen as the default defaultprocesslimit was 100, I guess thats not much and can easily go over.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct