{"record":{"id":"68e2badd7e36285d","repo":"vitessio/vitess","slug":"bad-ping-result-v","errorCode":null,"errorMessage":"bad ping result: %v","messagePattern":"bad ping result: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/grpctmclient/client.go","lineNumber":495,"sourceCode":"\n// ping runs the Ping RPC on an already-dialed connection, invalidating the pooled connection\n// (when an invalidator is provided) on a connection-level failure.\nfunc (client *Client) ping(ctx context.Context, c tabletmanagerservicepb.TabletManagerClient, invalidator invalidatorFunc) error {\n\tresult, err := c.Ping(ctx, &tabletmanagerdatapb.PingRequest{\n\t\tPayload: \"payload\",\n\t})\n\tif err != nil {\n\t\t// Only invalidate (close + redial) the pooled connection when the failure indicates the\n\t\t// connection itself is broken. A DeadlineExceeded/Canceled means the RPC did not finish in\n\t\t// time, not that the conn is bad — invalidating then would close + redial the pool on a\n\t\t// momentarily slow but alive peer, adding churn exactly when it is already stressed.\n\t\tif invalidator != nil && shouldInvalidatePooledConn(err) {\n\t\t\tinvalidator()\n\t\t}\n\t\treturn vterrors.FromGRPC(err)\n\t}\n\tif result.Payload != \"payload\" {\n\t\treturn fmt.Errorf(\"bad ping result: %v\", result.Payload)\n\t}\n\treturn nil\n}\n\n// shouldInvalidatePooledConn reports whether a failed pooled RPC indicates the connection itself is\n// likely broken (so it should be closed and redialed) rather than a transient timeout or\n// cancellation. A dead/unreachable peer surfaces as Unavailable and still invalidates.\nfunc shouldInvalidatePooledConn(err error) bool {\n\t// status.Code only recognizes gRPC status errors: a raw or wrapped\n\t// context.Canceled / context.DeadlineExceeded (e.g. the monitor shutting\n\t// down or a caller-side timeout firing before the RPC hits the wire) maps\n\t// to codes.Unknown and would needlessly close and redial a healthy\n\t// connection. Check the context errors directly first.\n\tif errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {\n\t\treturn false\n\t}\n\tswitch status.Code(err) {\n\tcase codes.DeadlineExceeded, codes.Canceled:","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/grpctmclient/client.go#L477-L513","documentation":"The gRPC tabletmanager client's Ping sends an RPC whose response is expected to echo the literal payload \"payload\". If the RPC succeeds but the returned Payload differs, the client assumes the response is wrong (wrong server, proxy mangling, corruption) and returns this error instead of silently treating the tablet as healthy.","triggerScenarios":"Ping or PingPooled on a gRPC tabletmanager client receives result.Payload != \"payload\" — e.g. an intermediary (proxy, older/mismatched vttablet build, different protocol) responds with an empty or altered body.","commonSituations":"Routing through an L7 proxy that rewrites gRPC bodies; a vttablet of a wildly different version answering the RPC; a misconfigured service pointing Ping at the wrong port/process.","solutions":["Verify the tablet address points at the real vttablet grpc port (vtctldclient Ping the tablet directly)","Check for proxies/load balancers between client and vttablet that might alter or empty the response","Confirm vttablet and client are compatible versions; upgrade the mismatched component","Enable gRPC logging on both sides to inspect the actual response payload"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify the target speaks tabletmanager gRPC before relying on Ping\nconn, err := grpc.Dial(addr); defer conn.Close()\n_ = tabletpb.NewTabletManagerClient(conn)","typeGuard":null,"tryCatchPattern":"if err := client.Ping(ctx, tabletAlias); err != nil {\n    if strings.Contains(err.Error(), \"bad ping result\") {\n        // suspect proxy/version mismatch; recheck endpoint\n    }\n}","preventionTips":["Ping tablets directly without intermediary proxies first","Keep vttablet and client versions aligned","Verify port mappings point at vttablet grpc, not http or mysql ports"],"tags":["grpc","vttablet","tabletmanager","ping"],"backgroundTag":"bad-ping-payload","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}