go.grpc.missing_deadline
Stability
Critical
Detects gRPC calls without deadline or timeout.
Why It Matters
Section titled “Why It Matters”gRPC calls without deadlines:
- Resource exhaustion — Hanging calls consume connections
- Cascading failures — Slow services block callers indefinitely
- No failure feedback — Clients wait forever
Example
Section titled “Example”// ❌ Before (no deadline)resp, err := client.GetUser(context.Background(), req)// ✅ After (with deadline)ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)defer cancel()
resp, err := client.GetUser(ctx, req)if err != nil { if status.Code(err) == codes.DeadlineExceeded { // Handle timeout } return nil, err}What Unfault Detects
Section titled “What Unfault Detects”- gRPC client calls with context.Background()
- Missing context.WithTimeout or WithDeadline
- Unreasonably long timeout values
Auto-Fix
Section titled “Auto-Fix”Unfault can wrap gRPC calls with appropriate timeout contexts.