You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A health tick in flight can overwrite StopAll's "stopped" with "running", so ResumeStopped skips the plugin #1091
Seen: CI on #1089 (a changelog-only PR) failed TestResumeStoppedRestoresStatusAndHealthLoop with resume_test.go:80: alpha after StopAll = "running", want stopped (run 39071923720). The log shows Plugin alpha: stopping (agent shutdown)before the failure, so StopAll saw alpha as running and saved "stopped", and something wrote "running" afterwards. It didn't reproduce locally in 400 runs (100 with -race), so the window is narrow.
Mechanism (pkg/pluginruntime):
A health tick finishes its check and blocks on rt.mu in recordHealthOK, because StopAll -> stopHealthLoop holds the lock while cancelling the loop.
stopHealthLoop releases the lock. The tick acquires it and Loads the state, still "running": StopAll saves "stopped" outsidert.mu and hasn't done so yet.
StopAll saves "stopped". The tick then saves its copy, "running" with a fresh last_health, over it.
setPluginStatus (degraded after 3 failures) has the same shape.
Effect on a real spore: the plugin reads as running after the agent shutdown. If that stop or hibernate then fails, ResumeStopped (#979) only resumes plugins recorded as stopped, so it skips this one and its health loop is never restored. A plugin that later fails goes unnoticed, which is the #979 bug again, but only in this narrow window.
Fix: both writers take the loop's ctx and return without writing if it is cancelled, checked under rt.mu. stopHealthLoop cancels under that same lock, so a tick that acquires it afterwards always sees the cancel.
Activity
Stop a stopped health loop's tick from overwriting StopAll's state (#…
Move the #1091 entry under Unreleased
Stop a stopped health loop's tick from overwriting StopAll's state (#…