Skip to content
Preptima

Top 7 Timeouts Interview Questions

Browse 7 real-world technical and behavioral interview questions about Timeouts. Review scenarios, edge cases, and architectural best practices.

A gRPC call three services deep hangs, and so does everything waiting on it. What was missing?

A gRPC deadline. gRPC sets none by default, so a client waits as long as the server takes, and every caller up the chain holds a thread or stream with it. Set a deadline at the edge, propagate the remaining budget on every hop, stop work on cancellation, and retry only inside what is left.

hardscenario

An asyncio call times out and you handle the TimeoutError, but the background task keeps running and mutates shared state a few seconds later. What happened, and how do you make the timeout actually stop the work?

A timeout requests cancellation; it does not stop code. CancelledError is raised at the task next await point, so a task inside blocking code, shielded, in an executor thread, or swallowing the exception keeps running and commits its side effects late. Fix by re-raising CancelledError, keeping blocking calls off the loop, and using asyncio.timeout with a TaskGroup.

hardconcept

A dependency that normally answers in 80ms starts taking eight seconds. What in your service reacts, and in what order?

A timeout shorter than the caller's patience is the only defence that works without cooperation. Retries need idempotency, jitter and a budget or they amplify the outage; a breaker must trip on latency as well as errors; and a bulkhead is what stops one slow dependency consuming every thread.

hardscenario

Write a helper that polls a condition until it is true or a timeout expires, then tell me what yours does when the condition throws.

A correct wait helper tracks a wall-clock deadline rather than an attempt count, treats an exception from the condition as a not-yet rather than a failure, returns the condition's value, and reports the last observed value or error when it gives up.

mediumcoding

A rider requests a car and forty drivers are within range. Which one do you pick, and how long do you have to decide?

Ride matching system design should rank drivers by estimated pickup time and market impact, not straight-line distance. Offer the ride under a short soft lock, use a small batching window when it improves assignment quality, and keep the rider wait within a few seconds. Use this dispatch answer to show the decision, trade-off, and evidence rather than a memorised definition.

hardcase study

A client hangs up halfway through a request. How do you structure a Go HTTP service so it stops doing the work?

Go context cancellation stops wasted request work when the client disconnects or a timeout expires. Pass the request context into database, HTTP and worker calls, and make goroutines return when ctx.Done closes.

mediumconcept

Customers need to upload two-gigabyte files to your API over a flaky connection. What does that endpoint look like, and what breaks if you just accept a POST body?

A single large POST fails on the last percent and starts again, and it drags every proxy body limit and idle timeout into your critical path. Either hand out a scoped credential so bytes go straight to storage, or model the upload as a resource with a committed offset the client can resume from.

harddesign