[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJuV1Q3tOJ-UFedQgdfdw=cAWfyE5x=LKE1V-jD5UDf+A@mail.gmail.com>
Date: Fri, 11 Aug 2023 09:38:22 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: menglong8.dong@...il.com
Cc: ncardwell@...gle.com, davem@...emloft.net, kuba@...nel.org,
pabeni@...hat.com, dsahern@...nel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, flyingpeng@...cent.com,
Menglong Dong <imagedong@...cent.com>
Subject: Re: [PATCH net-next v4 3/4] net: tcp: fix unexcepted socket die when
snd_wnd is 0
On Fri, Aug 11, 2023 at 5:01 AM <menglong8.dong@...il.com> wrote:
>
> From: Menglong Dong <imagedong@...cent.com>
>
> In tcp_retransmit_timer(), a window shrunk connection will be regarded
> as timeout if 'tcp_jiffies32 - tp->rcv_tstamp > TCP_RTO_MAX'. This is not
> right all the time.
>
> The retransmits will become zero-window probes in tcp_retransmit_timer()
> if the 'snd_wnd==0'. Therefore, the icsk->icsk_rto will come up to
> TCP_RTO_MAX sooner or later.
>
> However, the timer can be delayed and be triggered after 122877ms, not
> TCP_RTO_MAX, as I tested.
>
> Therefore, 'tcp_jiffies32 - tp->rcv_tstamp > TCP_RTO_MAX' is always true
> once the RTO come up to TCP_RTO_MAX, and the socket will die.
>
> Fix this by replacing the 'tcp_jiffies32' with '(u32)icsk->icsk_timeout',
> which is exact the timestamp of the timeout.
>
> However, "tp->rcv_tstamp" can restart from idle, then tp->rcv_tstamp
> could already be a long time (minutes or hours) in the past even on the
> first RTO. So we double check the timeout with the duration of the
> retransmission.
>
> Meanwhile, making "2 * TCP_RTO_MAX" as the timeout to avoid the socket
> dying too soon.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Link: https://lore.kernel.org/netdev/CADxym3YyMiO+zMD4zj03YPM3FBi-1LHi6gSD2XT8pyAMM096pg@mail.gmail.com/
> Signed-off-by: Menglong Dong <imagedong@...cent.com>
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Powered by blists - more mailing lists