fix(daemon): add 5s timeout to SubManagedCycle IPC handler (PILOT-309)#202
fix(daemon): add 5s timeout to SubManagedCycle IPC handler (PILOT-309)#202matthew-pilot wants to merge 1 commit into
Conversation
ForceCycle called from the IPC handler was a synchronous call to runCycle → fetchMembers → ListNodes, which is a network call with no timeout. A hung or slow registry would wedge the IPC handler goroutine indefinitely, denying service to that IPC client. Wrap the ForceCycle call in a background goroutine with a 5-second context deadline. On timeout, the handler returns an error to the client; the background goroutine completes the cycle asynchronously so peer state is still eventually refreshed. Closes PILOT-309
📊 PR Status — #202 PILOT-309
CI Checks
CanaryNot yet triggered. Linked JiraLast operator activityNo operator (TeoSlayer) activity detected on this PR. |
🔍 PR Explanation — #202 PILOT-309What this doesWraps the The problem
The fixIn
Design choices
Scope
|
|
🤖 Hank — CI status Classification: The build/test failure is a genuine code defect:
@matthew-pilot — fix or comment. Auto-classified at 2026-06-02T19:29:00Z. Re-runs on next push or check completion. |
🤖 PR Status — PilotProtocol #202CI Summary: CodeQL ❌ · Go (ubuntu-latest) ✅ · Go (macos-latest) ✅ · Architecture gates ❌ · Analyze Go ✅ · dispatch ✅ · snyk ✅
|
📋 PR Explanation — PilotProtocol #202What: Adds a 5-second timeout to the Why (PILOT-309): Without a timeout, the IPC handler for managed-cycle subscription can block indefinitely if the remote end fails to respond, tying up a goroutine and potential resources. The fix wraps the blocking send with Risk: Low (the timeout is generous at 5s; normal IPC completes in milliseconds). Review focus: |
🦾 Matthew PR Status — #202 PILOT-309State: OPEN · MERGEABLE (no merge conflicts) |
What
The
SubManagedCycleIPC handler calledForceCycle()synchronously, which chains throughrunCycle → fetchMembers → ListNodes— a network call to the registry with no timeout. A hung or slow registry would wedge the IPC handler goroutine indefinitely.Fix
Wrap the
ForceCyclecall in a background goroutine with a 5-secondcontext.WithTimeout. On timeout, the handler returns an error to the client; the background goroutine completes the cycle asynchronously so peer state is still eventually refreshed.Verification
go build ./...✅go vet ./...✅go test -parallel 4 -count=1 -timeout 900s ./pkg/daemon/✅ (58.9s, all pass)Scope
Closes PILOT-309