Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 01 Mar 2023 07:03:27 -0600
From:      Mike Karels <mike@karels.net>
To:        Michael Gmelin <grembo@freebsd.org>
Cc:        Yuri <yuri@freebsd.org>, freebsd-net@freebsd.org
Subject:   Re: sshd doesn't disconnect for 30+ minutes after the TCP connection is closed ungracefully
Message-ID:  <49CE5046-7934-414C-9B62-F3712DECBA52@karels.net>
In-Reply-To: <08DDB90C-5D30-40A3-86C0-87021959F04D@freebsd.org>
References:  <baf5faa3-3c03-fb9e-4196-bd26c2fc622e@tsoft.com> <08DDB90C-5D30-40A3-86C0-87021959F04D@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 1 Mar 2023, at 5:36, Michael Gmelin wrote:

>> On 1. Mar 2023, at 11:35, Yuri <yuri@freebsd.org> wrote:
>>
>> =EF=BB=BFWindows system connects to FreeBSD through ssh and then this =
connection dies because of WiFi or VPN issues.
>>
>> FreeBSD still has the sshd process alive for this connection for 30+ m=
inutes.
>>
>> TCP keepalive is enabled on the FreeBSD host:
>>
>> $ sysctl net.inet.tcp.always_keepalive
>> net.inet.tcp.always_keepalive: 1
>>
>> Shouldn't TCP keepalive kill this sshd process after 3-4 minutes becau=
se this connection isn't alive?
>>
>
> Keepalives start after net.inet.tcp.keepidle milliseconds (2h by defaul=
t).

When this happens to me, I generally log into the server again and use wr=
ite(1)
to send a message to that tty (a newline will do).  That probes the conne=
ction
and causes a reset, and the session gets cleaned up.  I use a longer keep=
idle
value for other reasons.

		Mike



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49CE5046-7934-414C-9B62-F3712DECBA52>