Dear dovecot team,
I believe I found a bug in dovecot on 32-bit systems.
Dovecot version: 1:2.4.1+dfsg1-6 (Architecture: i386)
Operating system: Linux lar 6.13.7-64+ #1 SMP PREEMPT Fri Mar 21 08:33:47 MEZ 2025 x86_64 GNU/Linux
Distributor ID: Debian Description: Debian GNU/Linux 13 (trixie) Release: 13 Codename: trixie
What led up to the situation? Upgrade from 2.3.21.1 to 1:2.4.1
What was the outcome of this action? Logs are flooded with messages "Warning: Time moved forward"
Problem Description:
The function io_loop_get_wait_time in ioloop.c contains the line:
ioloop->next_max_time.tv_sec = (1ULL << (TIME_T_MAX_BITS-1)) - 1;
On 32-bit systems TIME_T_MAX_BITS is 31 such that the result of this calculation is 1073741823. Far from the intended "infinity" and even before "now". This leads to problems in the function io_loop_handle_timeouts_real: the calculation of the time difference between now and next_max_time is then something like -693628953 seconds which confuses dovecot and floods the logs with these warnings:
Jan 02 17:43:43 lmtp(38364): Warning: Time moved forward 693630400.301863 seconds Jan 02 17:43:43 lmtp(38364): Warning: Time moved forward 693630400.304144 seconds Jan 02 17:45:43 lmtp(38364): Warning: Time moved forward 693630520.416053 seconds
- Possible solution/workaround ? ioloop->next_max_time.tv_sec = INT_MAX;
Thanks for your consideration, Andy