Project

General

Profile

Feature #7064

TCP_KEEPIDLE has needless 10sec minimum

Added by Robert Mustacchi over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
networking
Start date:
2016-06-06
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

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, [1], 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.

#1

Updated by Garrett D'Amore over 4 years ago

I have a feeling that there are probably some compelling reasons not to tune this too small. That said, this should only come into play on an otherwise idle connection, so as long as its > 2*RTT its probably ok.

#2

Updated by Electric Monk over 4 years ago

  • Status changed from New to Closed

git commit 995de72901a2c8b79bd3aea3df1617643d53ea89

commit  995de72901a2c8b79bd3aea3df1617643d53ea89
Author: Patrick Mooney <patrick.f.mooney@gmail.com>
Date:   2016-06-10T15:51:33.000Z

    7064 TCP_KEEPIDLE has needless 10sec minimum
    Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
    Reviewed by: Garrett D'Amore <garrett@damore.org>
    Approved by: Dan McDonald <danmcd@omniti.com>

Also available in: Atom PDF