Dovecot IMAP / POP3 Server working but shows off in status

I don' have any problems with the Dovecot IMAP / POP3 Server everything is working normally as far as I can tell.

The strange thing is that when I log on and check the System Information under Status the Dovecot IMAP / POP3 Server shows that it's stopped.

I click Start Dovecot and and the server shows running. I log off and on again and the server still shows running.

After some time (couple days) I log on again and the Status of the Dovecot IMAP / POP3 Server shows that it's stopped again, but the server was working normally

I have the same problem with all my virtualmin servers

Status: 
Active

Comments

When Webmin thinks that Dovecot is down like this, does the file /var/run/dovecot/master.pid contain the PID of the running Dovecot server process?

Yes, the file /var/run/dovecot/master.pid contains the PID of the running Dovecot server process.

But checking that directory I found another file that grabbed my attention: master-fatal.lastlog.

Dovecot showed stopped in status (in webmin) and this file disappeared as soon as I started Dovecot up again.

In that file I found the following: Time just moved backwards by 9 seconds. This might cause a lot of problems, so I'll just kill myself now. http://wiki.dovecot.org/TimeMovedBackwards

I checked the website and there: Dovecot isn't very forgiving if your system's time moves backwards. There are usually two possibilities why it's moving backwards:

  1. You're running ntpdate periodically. This isn't a good idea.
  2. You're using some kind of a virtual server and you haven't configured it right (or it's buggy).

I have both, ntpdate and it's a virtual server (but I'm not saying it's buggy).

I had "Time server sync" set up in "System Time" and therefore I needed ntpdate to do so. I removed ntpdate and installed ntp instead as recomended by wiki.dovecot.org,

I did this on one server only, the other servers I leave for now to see what result I get

Yeah, Dovecot will crash if it detects a large time change. On a VM that isn't getting its clock synced properly and has Webmin setup to sync the time periodically, this can trigger a crash of Dovecot.

Ok I got the problem solved.

It was a problem with ntpdate and the way I set up the system. So I never had any problems with Dovecot until, I logged on in webmin after a couple days, and the time had drifted enough.

"System Time" in webmin/ uses ntpdate. But when I look at the ntpdate specs it isn't really the type of program that should be run on a virtualmin server but ntp is.

Wouldn't it be better to provide fine tune settings in virtualmin/webmin for /etc/ntp.conf (as well or only)?

Indeed it's suggested to use "ntp", which in case of time differences doesn't adjust the clock harshly to the correct time, but does so in a number of "micro-adjustments", to prevent issues you've seen with Dovecot.

ntp doesn't really need a lot of fine-tuning. After installation, all you really could do is edit the time servers it uses by default.

Also, I think I saw in the logs that in later versions of Dovecot, they changed the "time has jumped backwards, I'm going to kill myself now" behavior to "time has jumped, I'm going to sleep for a while".