Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 04 Nov 2012 20:49:30 +0100
From:      Andre Oppermann <andre@freebsd.org>
To:        Fabian Keil <freebsd-listen@fabiankeil.de>, null@pozo.com
Cc:        freebsd-net@FreeBSD.org
Subject:   Re: kern/173309: [tcp] TCP connections often prematurely closed by the server side after r242262 [regression]
Message-ID:  <5096C6CA.4090306@freebsd.org>
In-Reply-To: <20121104132957.3965dc99@fabiankeil.de>
References:  <201211032251.qA3Mpnp6017076@freefall.freebsd.org> <5095B953.9060301@freebsd.org> <20121104132957.3965dc99@fabiankeil.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On 04.11.2012 13:29, Fabian Keil wrote:
> Andre Oppermann <andre@freebsd.org> wrote:
>
>> thank you for the bug report.  Please try the attached patch
>> which should fix the issue you observed.
>
> Thanks for the patch, Andre.
>
> It seems to make the transfers 100% reliably again,
> but they are frequently very slow:
>
> fk@r500 ~ $i=1; while curl -o /dev/zero 'http://127.0.0.1:81/90k-file'; do echo $i; ((i=$i+1)); done
>    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                   Dload  Upload   Total   Spent    Left  Speed
> 100 90000  100 90000    0     0   8670      0  0:00:10  0:00:10 --:--:--  2057
> 1
>    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                   Dload  Upload   Total   Spent    Left  Speed
> 100 90000  100 90000    0     0   8821      0  0:00:10  0:00:10 --:--:--  2057
> 2
>    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                   Dload  Upload   Total   Spent    Left  Speed
> 100 90000  100 90000    0     0   8821      0  0:00:10  0:00:10 --:--:--  2057
> 3
>    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                   Dload  Upload   Total   Spent    Left  Speed
> 100 90000  100 90000    0     0  33.0M      0 --:--:-- --:--:-- --:--:-- 42.9M
> 4
>    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                   Dload  Upload   Total   Spent    Left  Speed
> 100 90000  100 90000    0     0  32.5M      0 --:--:-- --:--:-- --:--:-- 85.8M
>
> Looks like this is caused by occasional 5 second pauses
> between packets after the client's TCP window update:

Fabian, Manfred,

The patch I sent was not correct.  Please try this new attached patch
instead.

-- 
Andre

Index: netinet/tcp_output.c
===================================================================
--- netinet/tcp_output.c        (revision 242577)
+++ netinet/tcp_output.c        (working copy)
@@ -228,7 +228,7 @@
         tso = 0;
         mtu = 0;
         off = tp->snd_nxt - tp->snd_una;
-       sendwin = min(tp->snd_wnd, tp->snd_cwnd);
+       sendwin = ulmax(ulmin(tp->snd_wnd - off, tp->snd_cwnd), 0);

         flags = tcp_outflags[tp->t_state];
         /*
@@ -249,7 +249,7 @@
             (p = tcp_sack_output(tp, &sack_bytes_rxmt))) {
                 long cwin;

-               cwin = min(tp->snd_wnd, tp->snd_cwnd) - sack_bytes_rxmt;
+               cwin = ulmin(tp->snd_wnd - off, tp->snd_cwnd) - sack_bytes_rxmt;
                 if (cwin < 0)
                         cwin = 0;
                 /* Do not retransmit SACK segments beyond snd_recover */
@@ -355,7 +355,7 @@
                          * sending new data, having retransmitted all the
                          * data possible in the scoreboard.
                          */
-                       len = ((long)ulmin(so->so_snd.sb_cc, tp->snd_wnd)
+                       len = ((long)ulmin(so->so_snd.sb_cc, tp->snd_wnd - off)
                                - off);
                         /*
                          * Don't remove this (len > 0) check !



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5096C6CA.4090306>