Agreed, though I don't see it "at every single mail". I looked at the commits you posted, and at the code around them, but could not find anything obvious.That's because I suspect the mechanism dovecot uses is borked and in fact responsible for all those (alleged) time diffs.
As said: this even happens on a perfectly synced host that has very little time deviation according to ntp - but dovecot claims it is constantly off (at *every single mail* that is delivered) by several orders of magnitude more than ntp is stating/adjusting.
Has nothing to do with epoll. Dovecot uses kqueue on FreeBSD. This indicates
clock issues, you should use ntpd to avoid this, alternatively your VM/machine
is lagging and clock is jumping forward.
Aki
May 7 06:15:00 dovecot dovecot[76104]: master: Warning: Time moved forwards by 0.199006 seconds - adjusting timeouts.
May 7 06:15:07 dovecot dovecot[76104]: master: Warning: Time moved forwards by 0.265371 seconds - adjusting timeouts.
[...]
May 7 07:22:08 dovecot dovecot[76104]: master: Warning: Time moved forwards by 0.395615 seconds - adjusting timeouts.
May 7 07:22:39 dovecot dovecot[76104]: master: Warning: Time moved forwards by 0.409265 seconds - adjusting timeouts.
[...]
May 7 09:33:10 dovecot dovecot[76104]: master: Warning: Time moved forwards by 0.155254 seconds - adjusting timeouts.
May 7 09:33:18 dovecot dovecot[76104]: master: Warning: Time moved forwards by 0.319233 seconds - adjusting timeouts.
[...]
May 7 11:32:08 dovecot dovecot[76104]: master: Warning: Time moved forwards by 0.127303 seconds - adjusting timeouts.
May 7 11:32:12 dovecot dovecot[76104]: master: Warning: Time moved forwards by 0.236399 seconds - adjusting timeouts.
[...]
May 7 12:07:12 dovecot dovecot[76104]: master: Warning: Time moved forwards by 0.479545 seconds - adjusting timeouts.
May 7 12:07:23 dovecot dovecot[76104]: master: Warning: Time moved forwards by 0.357021 seconds - adjusting timeouts.
# service ntpd stop && ntpdate pool.ntp.org
Stopping ntpd.
Waiting for PIDS: 12290.
7 May 12:29:15 ntpdate[56703]: adjust time server 131.188.3.223 offset -0.000112 sec
I'm a bit late to this and don't know whether it's significant or not.Still waiting for "moderator approval" of my message to the dovecot mailing list... because apparently they don't accept plaintext messages:
Code:The message's content type was not explicitly allowed
2024-07-01T02:30:34.410259+10:00 postfix.example.com dovecot 805 - - pop3(user@example.com)<27997><prT4/x0cEPAK1gED>: Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
2024-07-01T02:33:34.436940+10:00 postfix.example.com dovecot 799 - - master: Warning: Time moved forwards by 0.100146 seconds - adjusting timeouts. [3 mins]
2024-07-01T11:03:21.522368+10:00 postfix.example.com dovecot 805 - - lmtp(29305): Disconnect from local: Logged out (state=READY)
2024-07-01T11:06:21.740665+10:00 postfix.example.com dovecot 799 - - master: Warning: Time moved forwards by 0.100341 seconds - adjusting timeouts. [3 mins]
2024-07-02T02:38:34.523156+10:00 postfix.example.com dovecot 805 - - pop3(user@example.com)<30613><9PVtOjIcrvoK1gED>: Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
2024-07-02T02:41:34.559409+10:00 postfix.example.com dovecot 799 - - master: Warning: Time moved forwards by 0.110271 seconds - adjusting timeouts. [3 mins]
2024-07-02T20:35:17.834048+10:00 postfix.example.com dovecot 805 - - pop3(user@example.com)<32614><JX0VRUEcOcQK1gED>: Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
2024-07-02T20:37:17.747916+10:00 postfix.example.com dovecot 799 - - master: Warning: Time moved forwards by 0.110443 seconds - adjusting timeouts. [2 mins]
2024-07-02T22:05:17.846288+10:00 postfix.example.com dovecot 805 - - pop3(user@example.com)<32754><z8vzhkIcOMYK1gED>: Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
2024-07-02T22:07:17.907880+10:00 postfix.example.com dovecot 799 - - master: Warning: Time moved forwards by 0.100034 seconds - adjusting timeouts. [2 mins]
2024-07-03T05:04:43.632593+10:00 postfix.example.com dovecot 805 - - lmtp(33749): Disconnect from local: Logged out (state=READY)
2024-07-03T05:08:43.817282+10:00 postfix.example.com dovecot 799 - - master: Warning: Time moved forwards by 0.100075 seconds - adjusting timeouts. [4 mins]
2024-07-04T10:39:35.751931+10:00 postfix.example.com dovecot 805 - - lmtp(36667): Disconnect from local: Logged out (state=READY)
2024-07-04T10:41:35.854820+10:00 postfix.example.com dovecot 799 - - master: Warning: Time moved forwards by 0.109982 seconds - adjusting timeouts. [2 mins]
2024-07-04T11:34:39.801657+10:00 postfix.example.com dovecot 805 - - lmtp(36776): Disconnect from local: Logged out (state=READY)
2024-07-04T11:39:40.054802+10:00 postfix.example.com dovecot 799 - - master: Warning: Time moved forwards by 0.106985 seconds - adjusting timeouts. [5 mins]
2024-07-04T22:14:30.398091+10:00 postfix.example.com dovecot 858 - - pop3(user@example.com)<2359><VAGS42oc08sK1gED>: Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
2024-07-04T22:16:30.421074+10:00 postfix.example.com dovecot 854 - - master: Warning: Time moved forwards by 0.100003 seconds - adjusting timeouts. [2 mins]
2024-07-05T07:32:19.165897+10:00 postfix.example.com dovecot 858 - - lmtp(3545): Disconnect from local: Logged out (state=READY)
2024-07-05T07:34:19.210231+10:00 postfix.example.com dovecot 854 - - master: Warning: Time moved forwards by 0.100668 seconds - adjusting timeouts. [2 mins]
2024-07-05T11:02:13.222128+10:00 postfix.example.com dovecot 858 - - lmtp(3866): Disconnect from local: Logged out (state=READY)
2024-07-05T11:07:13.380022+10:00 postfix.example.com dovecot 854 - - master: Warning: Time moved forwards by 0.100777 seconds - adjusting timeouts. [5 mins]
Interesting. I don't have a POP3 listener configured. Maybe this is why I see them less frequently than some?I found that the vast majority (but not 100%) of these "Time moved forwards" logs occurred at almost an exact number of minutes after a POP3 (MUA) or LMTP (MTA) interaction. In this case postfix and dovecot are running on the same VM where time is maintained with NTP.
In an ideal world the problem should/could be solved, the reality is this has been rumbling on since 2021, the horse is dead Jim, upstream aren't interested, time to move on.The point is that the problem should be solved, and you can't solve it if you can't see it.
Version 2 of the Single UNIX Specification ("SUSv2") allows systems to
modify the original timeout in place. Thus, it is unwise to assume
that the timeout value will be unmodified by the select() system call.
FreeBSD does not modify the return value, which can cause problems for
applications ported from other systems.
Hallelujah...
Works for me.
pkg lock -l
Currently locked packages:
dovecot-2.3.21.1_1
opendmarc-1.4.2_3
postfix-current-3.10.20240724,6
Now merged into quarterly.I just built dovecot with that patch (currently only in latest; had to cherry-pick into quarterly) and am monitoring the logs. Looks good so far.
Some people were saying it happens mainly on idle hours. Maybe kqueue() is accurate with low timeout values, but not accurate on high timeout values? So if Dovecot asked kqueue() to wait for <100ms, it would be very accurate. But if it asks to wait for 10000ms, kqueue() would think it's okay to return after 10100ms. If that's the case, this check could be changed to allow higher time jumps only on higher timeout waits.