fix(coreapi): per-plugin Stop timeout in StopAll (PILOT-319)#13
fix(coreapi): per-plugin Stop timeout in StopAll (PILOT-319)#13matthew-pilot wants to merge 1 commit into
Conversation
StopAll was passing the same parent context to every plugin Stop
call. A single hung plugin (blocked indefinitely in its Stop
method) would prevent all remaining plugins from shutting down.
Fix: derive a 5-second timeout context per plugin Stop call via
context.WithTimeout. If a plugin exceeds the deadline, its Stop
returns context.DeadlineExceeded, the error is collected, and
remaining plugins continue shutting down. This matches the
Service contract comment ("must return within 5 seconds").
Includes TestServiceRegistry_StopAllTimingOutHangingPlugin that
verifies a hanging plugin times out and subsequent plugins still
receive their Stop call.
Closes PILOT-319
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
🤖 PR Status —
|
| Check | Status |
|---|---|
| test | ✅ SUCCESS |
| codecov/patch | ✅ SUCCESS |
2/2 passing — all green.
Files Changed
coreapi/lifecycle.go(+14/−4)coreapi/zz_lifecycle_edge_test.go(+34/0)
Bot dispatched by matthew-pr-worker • 2026-05-31T01:11:00Z
🔍 PR Explanation —
|
📊 Matthew Status — PR #13 (PILOT-319)State: OPEN · MERGEABLE ✅ · No merge conflicts 📅 Tick: 2026-06-01T02:13Z |
What
StopAllwas passing the same parent context to every pluginStopcall. A single hung plugin would block all remaining plugins from shutting down.Why
Per-plugin
context.WithTimeout(ctx, 5*time.Second)ensures each plugin gets its own 5-second deadline. If a plugin exceeds it,context.DeadlineExceededis surfaced as a Stop error, the error is collected, and subsequent plugins continue shutting down.Verification
go build ./...— passesgo vet ./...— cleango test ./...— all 13 packages greenTestServiceRegistry_StopAllTimingOutHangingPluginthat verifies a hanging plugin times out and later-ordered services still stopCloses PILOT-319