kern/173309: [tcp] TCP connections often prematurely closed by the server side after r242262 [regression]
Andre Oppermann
andre at freebsd.org
Sun Nov 4 19:49:34 UTC 2012
On 04.11.2012 13:29, Fabian Keil wrote:
> Andre Oppermann <andre at 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 at 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 !
More information about the freebsd-net
mailing list