On Tue, 2008-05-13 at 12:51 +0400, Anton Yuzhaninov wrote:
Timo Sirainen пишет:
On Tue, 2008-05-13 at 11:13 +0400, Eugene wrote:
I suggest that Dovecot simply terminate the current connections (causing the client to reconnect) or -- if the time change is really that much of a problem -- to restart itself automatically. I guess terminating all current connections and restarting all processes would be pretty safe, but it's not really a high priority change for me..
IMHO more robust is to use clock_gettime(CLOCK_MONOTONIC, ..) for timeouts and just work fine even if time was changed via settimeofday().
Two problems with that:
clock_gettime() doesn't work everywhere (e.g. OSX).
With the current design gettimeofday() has to be called anyway to get the current real timestamp, causing extra unnecessary work.
Anyway that's not the main problem. I'm more concerned about timestamp comparison code where one or both of the timestamps come from filesystem. It might cause some corruption, such as dotlock being deleted while another process still holds it.