Groups | Search | Server Info | Login | Register


Groups > comp.os.linux.networking > #8546

Re: How to get rid of client disconnected network sockets [changing tcp_keep_alive timeouts]

From Andrzej Adam Filip <anfi@onet.eu>
Newsgroups comp.os.linux.networking
Subject Re: How to get rid of client disconnected network sockets [changing tcp_keep_alive timeouts]
Date 2025-06-12 13:24 +0200
Organization It is for me to know and for you to find out.
Message-ID <anfi+b0266n2etf-p6c4@wp.eu> (permalink)
References <102ebko$2pkej$1@gwaiyur.mb-net.net>

Show all headers | View raw


Marcel Mueller <news.5.maazl@spamgourmet.org> wrote:
> from time to time network sockets are stuck for a very long time when
> the client is no longer online:
>
> netstat -4np
>> tcp        0      0 192.168.121.129:40830   192.168.121.1:49000
>> VERBUNDEN   1449463/vdr         tcp        0      0
>> 192.168.121.129:2049    192.168.121.137:939     VERBUNDEN   -
>> tcp        0      0 192.168.121.129:2049    192.168.121.139:912
>> VERBUNDEN   -                   tcp       45      0
>> 192.168.121.129:5143    192.168.121.24:41072    VERBUNDEN   -
>> tcp        0      0 192.168.121.129:22      192.168.121.137:55826
>> VERBUNDEN   1475830/sshd-sessio tcp        0      0
>> 192.168.121.129:2049    192.168.121.143:857     VERBUNDEN   -
>> tcp        0      0 192.168.121.129:22      192.168.121.137:42194
>> VERBUNDEN   1479707/sshd-sessio tcp       45      0
>> 192.168.121.129:5143    192.168.121.24:43014    VERBUNDEN   -
>> tcp       45      0 192.168.121.129:5143    192.168.121.33:56454
>> VERBUNDEN   -                   tcp        0      0
>> 192.168.121.129:5143    192.168.121.33:52444    VERBUNDEN
>> 1460557/VBoxHeadles 
>
> The clients 192.168.121.24 is disconnected for at least an hour, but
> the sockets at the server seem to stay for an infinite time.
> At some point I can no longer connect to the service at :5143. The
> client software (xfreerdp) just hangs.
>
> The only way to recover from this state is to end the listening
> process. Since this is a virtual machine this option is not very
> applicable.
>
> The lost connections are often related to client network disconnects,
> e.g. by a laptop entering suspend or WLAN interference. But this
> should result in a socket with state CLOSE_WAIT which is cleaned up
> after a short time. Of course, it is not reproducible. It happens only
> from time to time.
>
> How can I force the sockets to disconnect?
>
> System is Debian 13 running VBox headless VMs. (I do not use VBox NAT.)

AFAIR Classic recommendation is to change tcp keep_alive timeout.
It changes when kernel checks (sends probe packets) over inactive
tcp connection.  The default is after 2 hours (7200 seconds).
AFAIR some people reported changing it to 10 or 15 minutes.

Keywords for searches: linux tcp_keepalive_time
https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/usingkeepalive.html

-- 
[Andrew] Andrzej A. Filip

Back to comp.os.linux.networking | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

How to get rid of client disconnected network sockets Marcel Mueller <news.5.maazl@spamgourmet.org> - 2025-06-12 12:54 +0200
  Re: How to get rid of client disconnected network sockets [changing tcp_keep_alive timeouts] Andrzej Adam Filip <anfi@onet.eu> - 2025-06-12 13:24 +0200
    Re: How to get rid of client disconnected network sockets [changing tcp_keep_alive timeouts] Marcel Mueller <news.5.maazl@spamgourmet.org> - 2025-06-14 14:35 +0200
  Re: How to get rid of client disconnected network sockets Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-06-12 21:53 +0000
    Re: How to get rid of client disconnected network sockets Computer Nerd Kev <not@telling.you.invalid> - 2025-06-13 22:38 +1000
      Re: How to get rid of client disconnected network sockets Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-06-13 23:40 +0000
      Re: How to get rid of client disconnected network sockets Marcel Mueller <news.5.maazl@spamgourmet.org> - 2025-06-14 11:56 +0200
        Re: How to get rid of client disconnected network sockets Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-06-14 23:37 +0000
        Re: How to get rid of client disconnected network sockets candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> - 2025-06-18 05:30 +0000
          Re: How to get rid of client disconnected network sockets Marcel Mueller <news.5.maazl@spamgourmet.org> - 2025-06-18 10:00 +0200

csiph-web