On 05/01/2026 23:29, Andy Spiegl via dovecot wrote:

 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

   FWIW I've been observing the same issue on my 'lab' server since
   installing Dovecot last month. (That system is also 32-bit Debian Trixie
   and has the same version of Dovecot as above.) E.g.

 2026-01-03T12:03:27.105027+13:00 lab dovecot: lmtp(5344): Warning: Time moved 
forward 693653184.099749 seconds
 2026-01-03T12:03:27.110568+13:00 lab dovecot: lmtp(5344): Warning: Time moved 
forward 693653184.099842 seconds

   I suspected it was a 32-bit issue, but hadn't got as far as trying to
   diagnose. Nice work Andy! :-)

   I also had this happen once:

 2026-01-03T13:03:09.160310+13:00 lab dovecot: master: Panic: file time-util.h: 
line 40 (timeval_add_usecs): assertion failed: (usecs >= 0)
 2026-01-03T13:03:09.162076+13:00 lab dovecot: imap(5309): Panic: file 
time-util.h: line 40 (timeval_add_usecs): assertion failed: (usecs >= 0)
 2026-01-03T13:03:15.480689+13:00 lab dovecot: imap(5309): Error: Raw 
backtrace: #1 [unw_get_proc_name() failed: -10] -> #2 [unw_get_proc_name() 
failed: -10] -> #3 i_panic[0xb7a8cf13] -> #4 [unw_get_proc_name() failed: -10] 
-> #5 io_loop_handle_timeouts[0xb7b83eb0] -> #6 
io_loop_handler_run_internal[0xb7b861d0] -> #7 io_loop_handler_run[0xb7b863b0] 
-> #8 io_loop_run[0xb7b865c0] -> #9 master_service_run[0xb7ad02b0] -> #10 
main[0x004158c0] -> #11 [unw_get_proc_name() failed: -10] -> #12 
__libc_start_main[0xb7824d00] -> #13 _start[0x00416060]
 2026-01-03T13:03:15.484895+13:00 lab dovecot: master: Error: Raw backtrace: #1 
[unw_get_proc_name() failed: -10] -> #2 i_syslog_fatal_handler[0xb7c55960] -> 
#3 [unw_get_proc_name() failed: -10] -> #4 i_panic[0xb7b7af13] -> #5 
[unw_get_proc_name() failed: -10] -> #6 io_loop_handle_timeouts[0xb7c71eb0] -> 
#7 io_loop_handler_run_internal[0xb7c741d0] -> #8 
io_loop_handler_run[0xb7c743b0] -> #9 io_loop_run[0xb7c745c0] -> #10 
master_service_run[0xb7bbe2b0] -> #11 main[0x00426d30] -> #12 
[unw_get_proc_name() failed: -10] -> #13 __libc_start_main[0xb7912d00] -> #14 
_start[0x00427d20]
 2026-01-03T13:03:15.508827+13:00 lab dovecot: imap-login: Warning: Killed with 
signal 15 (by pid=1 uid=0 code=kill)
 2026-01-03T13:03:15.513404+13:00 lab dovecot: stats: Warning: Killed with 
signal 15 (by pid=1 uid=0 code=kill)
 2026-01-03T13:03:15.513766+13:00 lab dovecot: log(5302): Warning: Killed with 
signal 15 (by pid=1 uid=0 code=kill)
 2026-01-03T13:03:15.514010+13:00 lab dovecot: log(5302): Warning: Shutting 
down logging for 'imap-login: ' with 1 clients

   Given that this mentions time-util.h, I wonder if this issue is related?
   Unfortunately I don't have a core file for this.

   One thing I should point out is that this machine gets suspended
   regularly, and when I want to test something I wake it up (wake-on-lan),
   do stuff, then suspend it again.

   Nick.
_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to