Skip to content

python.grpc_no_deadline

Stability High Common in Incidents

Detects gRPC client calls without timeout parameter.

gRPC calls without deadlines are dangerous:

  • Infinite waits — If the server is unresponsive, the call waits forever
  • Resource exhaustion — Stuck calls hold connections and threads
  • Cascade failures — One slow service blocks all callers
  • No recovery — Unlike HTTP, gRPC doesn’t have browser-style timeouts

Deadlines are a fundamental gRPC best practice. Google’s own gRPC documentation emphasizes this heavily.

# ❌ Before
response = stub.GetUser(request)

If the server is slow or dead, this call never returns.

# ✅ After
response = stub.GetUser(request, timeout=30.0)

After 30 seconds, the call fails with DEADLINE_EXCEEDED.

  • gRPC stub method calls without timeout parameter
  • gRPC calls with timeout=None
  • Missing deadline in streaming calls

Unfault can add timeout=30.0 to gRPC calls when the pattern is recognized. Adjust based on your SLOs.

# Set appropriate timeouts based on operation type
# Quick lookups
user = stub.GetUser(request, timeout=5.0)
# Slower operations
report = stub.GenerateReport(request, timeout=60.0)
# Use deadline propagation in server handlers
def GetUser(self, request, context):
# Pass the deadline to downstream calls
remaining = context.time_remaining()
data = downstream_stub.GetData(req, timeout=remaining)