Questions about rescan interval, restart on wakeup, and OS/VM hibernation/suspend

I have two technical questions about the rescan interval, restart on wakeup, and their behaviour when suspending and resuming either an operating system or a VM.

  1. Rescan interval for a folder is set to 1d. Immediately after setting it, the operating system is hibernated/suspended. Then, it is woken up the following day. Will Syncthing detect the change and rescan the folder immediately (since 1 day has passed) or will it have to wait for another day to do the rescan? With “restart on wakeup” disabled, that is.

  2. The “restart on wakeup” does not work in a VM. I cannot speak for all of them, but if I suspend and then resume a machine in VirtualBox, Syncthing running inside that machine does not restart itself automatically. I guess that this is because suspending a VM is not the same as suspending or hibernating the OS itself. Is there anything that can be done to work around this?

Both things depend on the OS clock and timers, and how that behaves in your scenario is up to you to find out. :slight_smile: The restart on wake check works like this:

  • Sleep for x time
  • Look at the clock, did much more than x time pass?
  • If yes, we were suspended and should restart. If no, sleep again.

If the OS clock is incorrect when the VM wakes Syncthing can’t detect the suspension.

1 Like

Thank you for a quick answer. I will do some testing when I have time and report back.

I have another question though, and this is something that I have encountered recently. What happens if the system gets resumed or restarted with an incorrect system clock? This can often happen when the motherboard battery is dead (or there is no battery to begin with) and the power cord has been unplugged.

I have not observed any anomalies after rebooting the OS with such an incorrect clock, but I have not done any special testing either. Usually the OS (which is mainly Windows in this case, but also Android without a SIM card, etc.) does seem to update the clock almost immediately when establishing an Internet connection, but there is still this short period when the clock is not right.

It is safe to have Syncthing running when the system clock is wrong (and usually very wrong, as it normally gets reset to the motherboard’s manufactured date)?

Syncthing doesn’t really care about the system clock for anything that matters.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.