Re: TCP keepalive algorithm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



TCP keepalive only applies to idle connections. Its purpose primarily for cases where the local process waits for data from the peer indefinitely. If the peer disappears or reboots, the connection can tie up resources forever, so you need a keepalive. However, if the local TCP sends data, the connection will be terminated after a certain number of timeouts (controlled by tcp_retries2), usually much shorter than the keepalive timeout.

If you really want to shorten the time a connection dies during a network disconnection, you can pull down tcp_retries2, but do so at your own risk...

  -John


Jeff Weber wrote:
If I:

a)
enable TCP keepalive on a server,
lower the default keepalive parameters,
establish a connection from a client,
physically disconnect the server network,
monitor client socket read status with select()

the select() indeed notices the client socket is dead in an interval consistent with the keepalive parameters.

However, if I:

b)
enable TCP keepalive on a server,
lower the default keepalive parameters,
establish a connection from a client,
physically disconnect the server network,
periodically send data to the disconnected client socket   <-- NEW
monitor client socket read status with select()

the select() is not able to see the client socket is dead. That is, it appears that writing to a socket associated with a physically disconnected network interferes with the keepalive algorithm. I would expect that the inactivity timer associated with the socket keepalive algorithm is reset upon actually receiving traffic from the remote socket.

Is this the intended behavior of the TCP keepalive algorithm, or a bug?

[kernel = 2.4.27 on i686]

	TIA,
	Jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux