Skip to content

Conversation

omgold
Copy link

@omgold omgold commented Jul 1, 2022

Currently suspend detection does not work on Linux, as go's time.Since()
compares monotonic time, instead of wall time, which is halted during suspend.
This fixes the issue.

Currently suspend detection does not work on Linux, as go's time.Since()
compares monotonic time, instead of wall time, which is halted during suspend.
@tomasz1986
Copy link
Member

Please change the title to "cmd/syncthing: Fix restarting after system suspend (fixes #8341)".

@@ -763,7 +763,7 @@ func resetDB() error {

func standbyMonitor(app *syncthing.App, cfg config.Wrapper) {
restartDelay := 60 * time.Second
now := time.Now()
now := time.Now().Round(0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a comment explaining that rounding ensures wall time is used. Or make a tiny wallTimeNow utility method, such that the name is hte explanation.

@calmh
Copy link
Member

calmh commented Jul 1, 2022

I have a different suggestion. Monotonic time was introduced in Go 1.9 in 2017, five years ago. This apparently hasn't worked since then, and essentially nobody has noticed or complained. We should just remove the whole concept.

@ProactiveServices
Copy link
Contributor

We should just remove the whole concept.

Assuming you mean to remove the whole restart-on-wakeup feature I'd agree: I disable it as standard on every Syncthing install I manage, because of the resource drain it can cause, which is compounded by Every Other Thing doing CPU/IO when a machine is resumed.

@calmh
Copy link
Member

calmh commented Jul 1, 2022

Yes. The original issue that this fixes has been re-targeted to be about improved STUN behavior as well, which is the real issue here.

@calmh
Copy link
Member

calmh commented Jul 26, 2022

"Fixed" by #8449

@calmh calmh closed this Jul 26, 2022
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Jul 26, 2023
@syncthing syncthing locked and limited conversation to collaborators Jul 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants