top | item 41547687

(no title)

Bognar | 1 year ago

TCP implementations are an abstraction that work 99.99% of the time, but are still vulnerable to two generals when you look close. TCP is implemented in the kernel with a buffer, the kernel responds with ACKs before an application reads the data.

There is no guarantee that the application reads from that buffer (e.g. the process could crash), so the client on the other end believes that the application has received the message even though it hasn't.

The kernel is handling at-least-once delivery with the network boundary and turning it into at-most-once with the process boundary.

discuss

order

lisper|1 year ago

> still vulnerable to two generals

What makes you think the 2GP is relevant here? The 2GP has to do with coordination and consensus, not exactly-once delivery.

> TCP is implemented in the kernel with a buffer, the kernel responds with ACKs before an application reads the data.

True. Why do you think that matters?

> There is no guarantee that the application reads from that buffer

So? What does that have to do with exactly-once delivery? Even if the application does read the data, there's no guarantee that it does anything with it afterwards.

> The kernel is handling at-least-once delivery with the network boundary and turning it into at-most-once with the process boundary.

OK, if that's how you're defining your terms, I agree that you cannot have exactly-once delivery. But that makes it a vacuous observation. You can always get at-most-once delivery by disconnecting the network entirely. That provides a 100% guarantee that no message will be delivered more than once (because no message will ever be delivered at all). But that doesn't seem very useful.