fixes: support closable health server to avoid being stuck#734
Merged
mattisonchao merged 9 commits intomainfrom Jul 4, 2025
Merged
fixes: support closable health server to avoid being stuck#734mattisonchao merged 9 commits intomainfrom
mattisonchao merged 9 commits intomainfrom
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for a closable health server to ensure gRPC shutdown does not hang due to open health watch streams.
- Introduces
ClosableHealthServerincommon/rpcand replaces all uses ofhealth.NewServerwithrpc.NewClosableHealthServer - Updates
Server.Closeto call the newClose()on the health server - Adds
TestNewServerClosableWithHealthWatchto verify that health watch streams close cleanly
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| server/server_test.go | Added TestNewServerClosableWithHealthWatch but missing import for fmt |
| server/server.go | Switched from *health.Server to rpc.HealthServer and updated Close logic |
| server/internal_rpc_server_test.go | Updated tests to use rpc.NewClosableHealthServer |
| server/internal_rpc_server.go | Changed parameter and field type to rpc.HealthServer |
| server/assignment_dispatcher_test.go | Updated dispatcher tests to use rpc.NewClosableHealthServer |
| server/assignment_dispatcher.go | Updated dispatcher to accept rpc.HealthServer and use it in standalone dispatcher |
| common/rpc/closable_health_server.go | Implemented ClosableHealthServer with Close(), context cancellation, and watch handling |
Comments suppressed due to low confidence (1)
server/server_test.go:67
- The fmt package is used here but not imported; add
import "fmt"at the top of this test file.
client, closer, err := clientPool.GetHealthRpc(fmt.Sprintf("127.0.0.1:%v", server.InternalPort()))
coderzc
approved these changes
Jul 4, 2025
RobertIndie
approved these changes
Jul 4, 2025
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.
Motivation
Supports closable health servers to avoid the GRPC server graceful shutdown getting stuck due to the client watch stream not being closed.
Modification
ClosableHeathServerClosableHeathServerwhen the server closes.