gRPC Status DEADLINE_EXCEEDED — Request Timeout Before Completion
About gRPC Status DEADLINE_EXCEEDED
Fix gRPC DEADLINE_EXCEEDED status code (4) when an RPC call does not complete within the configured deadline or timeout period. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: gRPC status code 4 (DEADLINE_EXCEEDED) means the operation did not finish before the client's deadline. Every gRPC call should have a deadline — calls without deadlines can hang indefinitely. Deadlines propagate through the call chain: if service A calls B calls C, C inherits A's remaining deadline. This is functionally similar to HTTP 504 Gateway Timeout but with explicit deadline semantics. The server may still be processing the request after the client receives this error. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: Client deadline set too short for the operation being performed. Server processing time increased due to load, slow dependencies, or inefficient code. Network latency between client and server consuming most of the deadline budget. Downstream service calls in a chain consuming the propagated deadline. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: Review and increase the client deadline if it is too aggressive for the operation type. Profile the server-side handler to identify slow operations — database queries, external API calls. Implement deadline propagation correctly: pass context with deadline to all downstream calls. Add server-side deadline checking: if ctx.Err() == context.DeadlineExceeded, return early to save resources. Use streaming RPCs for operations that return large datasets instead of single unary calls. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our HTTP Status Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
What is a good default gRPC deadline?
There is no universal default. Set deadlines based on the operation: 500ms for simple lookups, 5s for database operations, 30s for complex computations. Never use no deadline — it risks hanging calls.
Overview
Fix gRPC DEADLINE_EXCEEDED status code (4) when an RPC call does not complete within the configured deadline or timeout period.
Key Details
- gRPC status code 4 (DEADLINE_EXCEEDED) means the operation did not finish before the client's deadline
- Every gRPC call should have a deadline — calls without deadlines can hang indefinitely
- Deadlines propagate through the call chain: if service A calls B calls C, C inherits A's remaining deadline
- This is functionally similar to HTTP 504 Gateway Timeout but with explicit deadline semantics
- The server may still be processing the request after the client receives this error
Common Causes
- Client deadline set too short for the operation being performed
- Server processing time increased due to load, slow dependencies, or inefficient code
- Network latency between client and server consuming most of the deadline budget
- Downstream service calls in a chain consuming the propagated deadline
Steps
- 1Review and increase the client deadline if it is too aggressive for the operation type
- 2Profile the server-side handler to identify slow operations — database queries, external API calls
- 3Implement deadline propagation correctly: pass context with deadline to all downstream calls
- 4Add server-side deadline checking: if ctx.Err() == context.DeadlineExceeded, return early to save resources
- 5Use streaming RPCs for operations that return large datasets instead of single unary calls