# rpc error: code = DeadlineExceeded desc = context deadline exceeded

- **ID:** `go/grpc-deadline-exceeded-server-slow`
- **Domain:** go
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The client-side context deadline elapsed before the server responded. Usually the server handler is slow (DB query, downstream call) or the deadline is too aggressive.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| google.golang.org/grpc v1.55+ | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   func (s *server) Get(ctx context.Context, req *pb.GetReq) (*pb.GetResp, error) {
    ctx, span := trace.StartSpan(ctx, "Get")
    defer span.End()
    if dl, ok := ctx.Deadline(); ok {
        log.Printf("deadline in %v", time.Until(dl))
    }
    return s.db.Query(ctx, req.Id) // pass ctx through
}
   ```
2. **** (85% success)
   ```
   b := backoff.NewExponentialBackOff()
b.MaxElapsedTime = 5 * time.Second
b.InitialInterval = 100 * time.Millisecond
return backoff.Retry(func() error {
    _, err := client.Get(ctx, req)
    return err
}, backoff.WithContext(b, ctx))
   ```

## Dead Ends

- **** — Removes the timeout but leaves slow handlers blocking goroutines indefinitely; cascading failures. (80% fail)
- **** — Synchronized retries amplify load on an already-overloaded server (thundering herd). (75% fail)
