Comment by mort96
2 years ago
If the feature already technically exists in TCP, it's either broken or disabled by default, which is pretty much the same as not having it.
2 years ago
If the feature already technically exists in TCP, it's either broken or disabled by default, which is pretty much the same as not having it.
keepalives are an optional TCP feature so they are not necessarily supported by all TCP implementations and therefor default to off even when supported.
Where is it off? Most linux distros have it on it’s just the default kickoff timer is ridiculously long (like 2 hours iirc). Besides, TCP keepalives won't help with the issue at hand and were put in for totally different purpose (gc'ing idle connections). Most of the time you don't even need them because the other side will send RST packet if it already closed the socket.
AFAIK, all Linux distros plus Windows and macOS have TCP keepalives off by default as mandated by the RFC 1122. Even when they are optionally turned on using SO_KEEPALIVE, the interval defaults to two hours because that is the minimum default interval allowed by spec. That can then be optionally reduced with something like /proc/sys/net/ipv4/tcp_keepalive_time (system wide) or TCP_KEEPIDLE (per socket).
By default, completely idle TCP connections will stay alive indefinitely from the perspective of both peers even if their physical connection is severed.
[0]: https://datatracker.ietf.org/doc/html/rfc1122#page-101
1 reply →
So we need a protocol with some kind of non-optional default-enabled keepalive.
Now your connections start to randomly fail in production because the implementation defaults to 20ms and your local tests never caught that.
1 reply →
You're conflating all optional TCP features of all operating systems, network devices, and RFCs together. This lack of nuance fails to appreciate that different applications have different needs for how they use TCP: ( server | client ) x ( one way | chatty bidirectional | idle tinygram | mixed ). If a feature needs to be used on a particular connection, then use it. ;)