The Puzzle
Imagine a dense wireless network utilizing edge computing to maintain ultra-low latency for a fleet of autonomous drones. A drone is moving out of range of Edge Server A and moving into the optimal range of Edge Server B.
To maintain a seamless connection, Server A and Server B must execute a “handover” of the drone’s session at the exact same millisecond. If Server A drops the connection before B is ready, the drone loses control. If B takes over before A releases it, data corruption causes a system crash.
They communicate via a wireless backhaul channel to coordinate the exact timestamp $T$ for the handover. However, this dense network is heavily congested, meaning any message sent between Server A and Server B has a non-zero probability of being dropped.
Server A sends the initial message: “Let’s execute the handover at $T$. Validate receipt.”
How can Server A and Server B communicate to reach 100% certainty that they will both execute the handover at timestamp $T$?
Let the state of Server A be $S_A$ and Server B be $S_B$. Both must transition to state $Commit$ simultaneously.
They communicate over a channel where the probability of message loss is $P(loss) > 0$.
A server will only transition to $Commit$ if it knows the other server is also transitioning to $Commit$. Therefore, Server A requires an acknowledgment (ACK) from Server B.
👁️ Toggle Solution, Hints & Variations
Hints
- Hint 1 (Clarification): Server A sends the proposal. Server B receives it and sends an ACK. But does Server B know if its ACK successfully reached Server A?
- Hint 2 (Structural): If Server B isn’t sure its ACK arrived, it cannot safely commit. It needs an ACK from Server A confirming that Server A received Server B’s ACK.
- Hint 3 (The Pivot): Assume there is some finite number of messages, $n$, that guarantees consensus. What happens if the $n$-th message is dropped?
💡 View Solution
The Solution
This is a modern framing of the classic Two Generals’ Problem, and the solution is that reaching 100% certainty is mathematically impossible.
We can prove this by contradiction. Assume there is a minimum sequence of $n$ successful messages that results in both servers reaching absolute certainty to commit.
Since the network is lossy, the $n$-th message might be dropped. The sender of this final $n$-th message cannot know if it was received unless they get an $(n+1)$-th message acknowledging it. If the receiver of the $n$-th message commits without sending an acknowledgment, the sender is left in a state of uncertainty. Therefore, $n$ messages are not sufficient, contradicting our assumption. No matter how many ACKs are sent, the sender of the last message can never be sure it arrived, leaving the system in a perpetual state of doubt.
Computational Verification
We can simulate the impossibility of reaching absolute state agreement using a simple recursive check.
import random
def send_message(depth, max_depth):
# Simulating a channel with a 20% chance of dropping the message
if random.random() < 0.2:
return False, "Message dropped"
if depth == max_depth:
# The final required message is reached, but the sender doesn't know it arrived!
return True, "Reached max depth, but sender is unconfirmed."
# To be certain, the receiver must send an ACK (increasing depth)
success, reason = send_message(depth + 1, max_depth)
return success, reason
# No matter how high we set max_depth, the final message is always vulnerable.
print(send_message(1, 100))
Variations & Practical Applications
In real-world networks (like LTE/5G handovers, load balancing, or TCP/IP handshakes), engineers must accept that 100% deterministic consensus over a lossy link is impossible.
Instead of perfect certainty, networks rely on probabilistic certainty and mitigation strategies. The TCP 3-way handshake (SYN, SYN-ACK, ACK) establishes a highly reliable connection, but relies on timeouts and retransmissions if the final ACK is lost. In drone/cellular networks, handovers utilize “make-before-break” protocols, where overlapping coverage zones allow the client to momentarily communicate with both nodes, trading strict simultaneous state changes for fault tolerance.
Further Exploration