Course contentsShow
← System Design
Lesson 1096 of 1,91928. Timeouts and DeadlinesFree lesson

Why Timeouts Must Propagate

Understanding how timeouts in one service must flow to downstream calls to prevent resource exhaustion and cascading delays.

Why Timeouts Must Propagate

What you'll learn: How failing to pass timeout context downstream creates hidden resource exhaustion and cascading delays.

The Chain-of-Responsibility Problem

Imagine a client gives Service A a 5-second timeout. Service A calls Service B, which calls Service C. If Service A doesn't tell Service B about the original deadline, Service B might spend 10 seconds waiting on Service C — even though the client has already given up.

This creates zombie work: resources tied up doing computation no one will ever use.

Why Non-Propagating Timeouts Fail

When each service uses its own independent timeout without considering upstream deadlines:

  • Resource exhaustion: Threads, connections, and memory stay occupied long after the original request died
  • Queue buildup: Failed requests leave behind tasks that still run to completion
  • Cascading delays: Slow downstream services block upstream callers, even when the top-level request already timed out
  • Retry amplification: Clients retry after timeout, but the original request is still processing, doubling the load

Proper Propagation Pattern

The correct approach: every downstream call must receive a remaining timeout derived from the parent context:

  • Client → Service A (5s timeout)
  • Service A → Service B (4s remaining, accounting for A's work)
  • Service B → Service C (3s remaining, accounting for B's work)

When Service C times out at 3s, the entire chain fails fast. No zombie work survives.

This is why modern frameworks use context objects that carry deadline information automatically.

Key Takeaway: Timeouts must flow through the entire call chain with decreasing budgets; otherwise, downstream services waste resources on work that upstream callers have already abandoned, causing hidden resource leaks and cascading delays.