Skip to content

Stop a stopped health loop's tick from overwriting StopAll's state (#1091) - #1092

Merged
scttfrdmn merged 2 commits into
mainfrom
fix/health-tick-overwrites-stopall
Oct 17, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
fix/health-tick-overwrites-stopall

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1091

A health tick blocked on rt.mu while StopAll stopped its loop could load "running" before StopAll saved "stopped" (that save is outside the lock) and then write "running" back over it. recordHealthOK and setPluginStatus now take the loop's ctx and write nothing once it is cancelled. The check is made under rt.mu, which is the lock stopHealthLoop cancels under.

Gate: TestHealthTickAfterItsLoopStoppedWritesNothing checks the invariant directly, since the interleaving is too narrow to hit on demand (CI hit it once; 400 local runs didn't). It includes a live-loop control. Against a revert that compiles (ctx.Err() != nil && false), it fails on both writers.

Checks: go vet, the package tests, 50 runs of the resume and health-tick tests under -race, and staticcheck with GOOS=linux all pass. Also adds a CHANGELOG entry under Fixed.

@codecov

codecov Bot commented Oct 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/pluginruntime/health.go 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn force-pushed the fix/health-tick-overwrites-stopall branch from bdf06d0 to c45c52a Compare October 17, 2026 22:06
@scttfrdmn
scttfrdmn merged commit ea0c3af into main Oct 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A health tick in flight can overwrite StopAll's "stopped" with "running", so ResumeStopped skips the plugin

1 participant