Why Networks Force Retries and Duplicates
The fundamental problem
In a distributed system, every network call can fail in two indistinguishable ways: the request never reached the server, or the request did reach the server and succeeded but the response was lost on the way back. From the caller's point of view both look identical — a timeout.
Because the caller cannot tell which happened, the only safe behavior is to retry. But if the original request actually succeeded, the retry creates a duplicate: a second charge, a second order, a second email.
- Lost request: retry is necessary and correct.
- Lost response: retry creates an unwanted duplicate.
This is sometimes called the Two Generals Problem in disguise: there is no way to guarantee both sides agree on whether a single message was delivered exactly once using an unreliable channel. The practical answer is not to eliminate duplicates at the network layer — it is to make the receiver tolerate them. That tolerance is called idempotency.
An operation is idempotent if performing it once has the same effect as performing it N times. SET balance = 100 is idempotent; balance = balance + 100 is not.