Repository navigation
grpc_client: check SERVING status in Ping - #377
alliasgher wants to merge 3 commits into
Conversation
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>
|
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
tgross
left a comment
There was a problem hiding this comment.
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?
| } | ||
|
|
||
| if resp.Status != grpc_health_v1.HealthCheckResponse_SERVING { | ||
| return fmt.Errorf("plugin %q health check returned non-SERVING status: %s", GRPCServiceName, resp.Status) |
There was a problem hiding this comment.
Isn't GRPCServiceName just the const "plugin"? This looks like we've grabbed that without knowing where it came from.
|
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. |
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.