Skip to content

grpc_client: check SERVING status in Ping - #377

Open
alliasgher wants to merge 3 commits into
hashicorp:mainfrom
alliasgher:fix-grpc-ping-check-serving
Open

alliasgher wants to merge 3 commits into
hashicorp:mainfrom
alliasgher:fix-grpc-ping-check-serving

Conversation

@alliasgher

Copy link
Copy Markdown

Fixes #341. GRPCClient.Ping only checked whether the RPC call returned an error. A reachable but non-SERVING plugin would pass Ping. Now the response status is validated and an error is returned if it is not SERVING.

GRPCClient.Ping only checked whether the gRPC health-check RPC
returned an error. A plugin that is reachable but in a non-SERVING
state (e.g. NOT_SERVING) would cause Ping to return nil even though
the plugin is not ready to serve requests.

Propagate the response status: if it is not HealthCheckResponse_SERVING,
return an error that includes the service name and the status value.

Fixes hashicorp#341

Signed-off-by: alliasgher <alliasgher123@gmail.com>
@alliasgher
alliasgher requested a review from a team as a code owner April 14, 2026 06:41
@hashicorp-cla-app

hashicorp-cla-app Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@hashicorp-cla-app

Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

…otobuf/ptypes/empty

Replace the deprecated github.com/golang/protobuf/ptypes/empty import
with the canonical google.golang.org/protobuf/types/known/emptypb.

The underlying wire format is identical — the two packages are
wire-compatible aliases — so this is a no-op at runtime but removes
the dependency on the legacy module.

Fixes hashicorp#338

Signed-off-by: alliasgher <alliasgher123@gmail.com>
…-serving

# Conflicts:
#	go.mod
#	grpc_stdio.go
#	plugin_test.go
@alliasgher
alliasgher requested a review from a team as a code owner September 27, 2026 09:50

@tgross tgross left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue described in #341 feels pretty esoteric. Keep in mind that the purpose of this library is first and foremost to support HashiCorp's products, so if there's something that's technically correct ("the best kind of correct") but actually breaks a bunch of real plugin uses, that cannot be accepted. What kind of validation has been done here?

Comment thread grpc_client.go
}

if resp.Status != grpc_health_v1.HealthCheckResponse_SERVING {
return fmt.Errorf("plugin %q health check returned non-SERVING status: %s", GRPCServiceName, resp.Status)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't GRPCServiceName just the const "plugin"? This looks like we've grabbed that without knowing where it came from.

@alliasgher

Copy link
Copy Markdown
Author

Validation was unit tests only, not real HashiCorp plugins. GRPCServiceName is the service the server registers SERVING under, and Ping already queried it. Happy to close if the risk isn't worth it.

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.

GRPCClient Ping method does not check health response

2 participants