Interview practice question
Waiting forever for a result
Backend Engineering · Concurrency · Intermediate
Code waits on a future for a downstream result with future.get() and sometimes hangs indefinitely. How do you fix it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- get() without timeout blocks forever.
- Use get(timeout).
- Cancel the future on timeout.
- Propagate deadlines.
- Timeouts on the underlying call too.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.