Bug 238741 - [tcp] Using RACK with CDG CC causes connections to hang
Summary: [tcp] Using RACK with CDG CC causes connections to hang
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.0-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: Michael Tuexen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-21 10:52 UTC by adrik
Modified: 2021-05-29 06:18 UTC (History)
6 users (show)

See Also:
tuexen: mfc-stable13+
tuexen: mfc-stable12+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description adrik 2019-06-21 10:52:28 UTC
When using the RACK tcpip stack, fetch will hang and eventually generate a timeout.
To reproduce the problem:

# uname -a
FreeBSD mail.xxx.yyy 12.0-RELEASE-p6 FreeBSD 12.0-RELEASE-p6 r349226 MAIL  amd64
# kldload tcp_rack
# sysctl net.inet.tcp.functions_default=rack
# fetch https://cpan.metacpan.org/authors/id/I/IS/ISHIGAKI/JSON-PP-4.03.tar.gz

When using wget, the same url can be retrieved without problems.
Comment 1 adrik 2019-06-28 13:44:44 UTC
I think the problem might be related to the selected TCP Congestion Control algorithm.
If I select Cdg as the TCP Congestion Control algorithm:

# kldload cc_cdg
# sysctl net.inet.tcp.cc.algorithm=cdg

Tcp connections will sometimes hang and finally timeout.
When this happens, the socket Send-Q is not empty and will never drain, so some or all data is never sent.

# netstat -6n
Active Internet connections
Proto Recv-Q Send-Q Local Address          Foreign Address        (state)
tcp6       0    383 2a02:xxxx:yyy:18.56748 2a04:4e42:9::729.443   ESTABLISHED

The same happens with IPv4 and IPv6 connections.
If I change the TCP Congestion Control to any other algorithm, the problem doesn't exist anymore.
I did a quick test with NewReno, Cubic, HTcp and Chd as the selected TCP Congestion Control algorithm and all work.
Comment 2 Michael Tuexen freebsd_committer freebsd_triage 2021-02-02 11:25:22 UTC
I can confirm that the combination of CDG and RACK results in a stalled transfer. I tested this with FreeBSD current.
Comment 3 Michael Tuexen freebsd_committer freebsd_triage 2021-02-17 14:52:00 UTC
rrs@ proposed a fix, I tested it: it works. rrs@ will commit the fix soon.
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-03-02 11:36:53 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=99adf230061268175a36061130e6adb0882270e8

commit 99adf230061268175a36061130e6adb0882270e8
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-03-02 11:32:16 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2021-03-02 11:32:16 +0000

    RACK: fix an issue triggered by using the CDG CC module

    Obtained from:          rrs@
    MFC after:              3 days
    PR:                     238741
    Sponsored by:           Netlix, Inc.

 sys/netinet/tcp_stacks/rack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2021-03-04 09:46:04 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=ae608d4ee7202cc34603e620bc551547e772c4d2

commit ae608d4ee7202cc34603e620bc551547e772c4d2
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-03-02 11:32:16 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2021-03-04 09:44:50 +0000

    RACK: fix an issue triggered by using the CDG CC module

    Obtained from:          rrs@
    PR:                     238741
    Sponsored by:           Netlix, Inc.

    (cherry picked from commit 99adf230061268175a36061130e6adb0882270e8)

 sys/netinet/tcp_stacks/rack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-03-04 10:37:15 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=dc27d5312b782b72740d71d81435a80dfe8b78bd

commit dc27d5312b782b72740d71d81435a80dfe8b78bd
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-03-02 11:32:16 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2021-03-04 10:35:03 +0000

    RACK: fix an issue triggered by using the CDG CC module

    Manually resolved merge conflics.

    Obtained from:          rrs@
    PR:                     238741
    Sponsored by:           Netlix, Inc.

    (cherry picked from commit 99adf230061268175a36061130e6adb0882270e8)

 sys/netinet/tcp_stacks/rack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-03-04 11:02:20 UTC
A commit in branch releng/13.0 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=43a2f41379f5b2a5aea94cc8389b181bf2d35b65

commit 43a2f41379f5b2a5aea94cc8389b181bf2d35b65
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-03-02 11:32:16 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2021-03-04 11:00:34 +0000

    RACK: fix an issue triggered by using the CDG CC module

    Obtained from:          rrs@
    Approved by:            re (gjb)
    PR:                     238741
    Sponsored by:           Netlix, Inc.

    (cherry picked from commit 99adf230061268175a36061130e6adb0882270e8)
    (cherry picked from commit ae608d4ee7202cc34603e620bc551547e772c4d2)

 sys/netinet/tcp_stacks/rack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)