From 9af071ef17908c04121f0ee9f304a0c5e39c0a29 Mon Sep 17 00:00:00 2001 From: Alexandr Stelnykovych Date: Mon, 1 Dec 2025 13:32:46 +0200 Subject: [PATCH] fix(control): ensure wall-clock comparison for resume worker deadline --- service/control/pause.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/service/control/pause.go b/service/control/pause.go index 6f8f5f53..822f6f90 100644 --- a/service/control/pause.go +++ b/service/control/pause.go @@ -143,7 +143,9 @@ func (c *Control) stopResumeWorker() { // startResumeWorker starts a worker that will resume normal operation after the specified duration. // No thread safety, caller must hold c.locker. func (c *Control) startResumeWorker(duration time.Duration) { - deadline := time.Now().Add(duration) + // Strip monotonic clock from deadline to force wall-clock comparison. + // This is critical for VM suspend/resume and system sleep scenarios. + deadline := time.Now().Round(0).Add(duration) c.pauseInfo.TillTime = deadline resumerWorkerFunc := func(wc *mgr.WorkerCtx) error { @@ -173,7 +175,8 @@ func (c *Control) startResumeWorker(duration time.Duration) { needToAutoResume = true } case <-ticker.C: - if time.Now().After(deadline) { + // Check wall-clock time. + if time.Now().Round(0).After(deadline) { needToAutoResume = true } case <-timer.C: