fix: restart unhealthy wrapper instances - #6
Merged
Conversation
Co-authored-by: Codex <noreply@openai.com> Signed-off-by: LYJW131 <lyjw2007@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Root cause
Wrapper context creation enters non-cancelable native FairPlay calls while holding a process-global context mutex. If a native call wedges, new wrapper connection threads remain blocked behind that mutex. The manager previously discarded only the timed-out TCP connection and then reconnected to the same unhealthy process, causing the failure to accumulate until even concurrency one timed out.
Impact
The gRPC API and configuration remain unchanged. A manager-owned 30-second loopback I/O timeout now quarantines and restarts only the affected wrapper. Client cancellation and client-owned deadlines do not trigger recovery. Concurrent failures schedule exactly one restart, and stale failures cannot remove or terminate a replacement with the same wrapper ID.
Validation
GOTOOLCHAIN=go1.23.5 go test ./...GOTOOLCHAIN=go1.23.5 go test -race ./...GOTOOLCHAIN=go1.23.5 go vet ./...-race -count=100SIGSTOPinjections each produced exactly one quarantine/down/replacement cycle