Questions / Quant development, Networking & latency

Retry an order without duplicating it

Applied, about 6 minutes. Question D023.

An order submission times out. You do not know whether the server accepted it. What helps make a retry safe?

  1. ARetry the same request identity and reconcile its status.
  2. BRetry with a fresh request identity.
  3. CRetry with a fresh request ID and cancel the first if it appears.
  4. DAssume failure and submit the replacement before checking status.

Answer it in the app It's free. You get hints, a second try if you miss, and a follow-up question.

Show the answer and worked solution

Answer: A. Retry the same request identity and reconcile its status.

  1. The server may have accepted the order before its response was lost. The client therefore has an unknown outcome, not proof of failure.
  2. A stable idempotency key lets the server recognize a retry of that logical request. Follow its conflict and status-query contract before taking further action.

Interview shortcut. Timeout = unknown outcome; retry with the same idempotency key.

Takeaway. Resolve ambiguous outcomes using request identity and reconciliation.

Why the other choices fail

  • Retry with a fresh request identity. A fresh identity can be accepted as a second order if the first submission already succeeded.
  • Retry with a fresh request ID and cancel the first if it appears. A fresh ID can create a second order if the first was accepted.
  • Assume failure and submit the replacement before checking status. A timeout reports missing confirmation, not a confirmed rejection. Acting on that assumption can duplicate exposure.

In the app this has a follow-up where one thing about the setup changes. Try the follow-up.

More networking & latency questions