TCP_KEEPIDLE has needless 10sec minimum
Reported by h0lzi via GH:
You can only set TCP_KEEPIDLE to be 10 seconds+ small test programm from here: joyent/node#21080 set to e.g. 5 seconds: LX_DEBUG: 41224/1: setsockopt(9, 6, 4, 0x7fffffefbe28, 4) 41224/1: lx_emulate(54) done (ret -22 / 0xffffffffffffffea ; errno 22) truss -t setsockopt nodejs socket.js /1: setsockopt(10, tcp, 0x22, 0x7FFFFFEFBE38, 4, SOV_DEFAULT) Err#22 EINVAL set to 10 seconds+ 41234/1: setsockopt(11, 6, 4, 0x7fffffefbe28, 4) 41234/1: lx_emulate(54) done (ret 0 / 0x0 ; errno 0) which is correct as tcp_keepidle is just a wrapper around TCP_KEEPALIVE_THRESHOLD and for this according to the manpage: The minimum value is ten seconds. The maximum is ten days, while the default is two hours. So you could argue it's a programmers error. Problem is linux does allow tcp_keepidle from 1 seconds+ Linux strace: setsockopt(10, SOL_TCP, TCP_KEEPIDLE, , 4) = 0 tuxillo reported this at #smartos irc channel. He has a programm that wants to set TCP_KEEPIDLE onto something less then 10 seconds. Not sure how this should be addressed. I don't get why there is this 10 seconds minimum though.
This is due to the lower bound on the tcp_keepalive_interval being set at 10 seconds. FreeBSD doesn't appear to place any lower bound on the value. The minimum on Linux is 1 second. I don't see a compelling reason why the minimum should not be dropped to 1 second, but I would like to confirm with danmcd prior to making the change. Dan didn't have any other background on the tunable minimum.
Updated by Electric Monk over 4 years ago
- Status changed from New to Closed
commit 995de72901a2c8b79bd3aea3df1617643d53ea89 Author: Patrick Mooney <email@example.com> Date: 2016-06-10T15:51:33.000Z 7064 TCP_KEEPIDLE has needless 10sec minimum Reviewed by: Josef 'Jeff' Sipek <firstname.lastname@example.org> Reviewed by: Garrett D'Amore <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>