Chapter 40: Debugging, Troubleshooting, and War Stories

Debugging Tools

ToolUse For
grpcurlManual RPC calls (like curl for gRPC)
grpc-health-probeCheck health endpoint
GRPC_VERBOSITY=DEBUGEnable verbose gRPC logging
GRPC_TRACE=allTrace internal gRPC events
WiresharkInspect HTTP/2 frames on wire (with TLS keys)
EvansInteractive gRPC REPL

Common Problems

SymptomLikely CauseFix
UNAVAILABLE on first callChannel not connected yet (lazy)Wait for channel READY or use WaitForConnected()
DEADLINE_EXCEEDEDServer too slow or network issueIncrease deadline, check server logs, check DNS
All RPCs go to one podL4 LB + long-lived connectionUse L7 LB (Envoy) or client-side round_robin
Connection drops after idleNAT/LB timeout (5-10 min)Configure keepalive (30s ping interval)
RESOURCE_EXHAUSTEDMessage too large (>4MB default)Increase max_receive_message_length or chunk data
UNIMPLEMENTEDMethod not registered or wrong service nameCheck proto package, service registration

Environment Variables for Debugging

# Enable all gRPC debug logging:
export GRPC_VERBOSITY=DEBUG
export GRPC_TRACE=all

# Trace specific subsystems:
export GRPC_TRACE=connectivity_state,channel,http

# Log to stderr:
export GRPC_GO_LOG_SEVERITY_LEVEL=info
🎓 Congratulations!

You've completed the gRPC Zero to Hero guide. You now understand gRPC from protocol fundamentals through production deployment. The next step: build something. Pick a small service, define a .proto, generate code, implement it, deploy it, load test it.