Re: [tcpm] Possible deadlock scenario with retransmission on both sides at the same time

Yoshifumi Nishida <nishida@sfc.wide.ad.jp> Tue, 23 August 2016 07:06 UTC

Return-Path: <nishida@sfc.wide.ad.jp>
X-Original-To: tcpm@ietfa.amsl.com
Delivered-To: tcpm@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id EADA812B041 for <tcpm@ietfa.amsl.com>; Tue, 23 Aug 2016 00:06:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.448
X-Spam-Level:
X-Spam-Status: No, score=-2.448 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RP_MATCHES_RCVD=-0.548, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M7HEVR4P9K21 for <tcpm@ietfa.amsl.com>; Tue, 23 Aug 2016 00:06:51 -0700 (PDT)
Received: from mail.sfc.wide.ad.jp (shonan.sfc.wide.ad.jp [IPv6:2001:200:0:8803::53]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id AA9EB12B038 for <tcpm@ietf.org>; Tue, 23 Aug 2016 00:06:51 -0700 (PDT)
Received: from mail-ua0-f173.google.com (mail-ua0-f173.google.com [209.85.217.173]) by mail.sfc.wide.ad.jp (Postfix) with ESMTPSA id 296C1278386 for <tcpm@ietf.org>; Tue, 23 Aug 2016 16:06:50 +0900 (JST)
Received: by mail-ua0-f173.google.com with SMTP id n59so229857128uan.2 for <tcpm@ietf.org>; Tue, 23 Aug 2016 00:06:50 -0700 (PDT)
X-Gm-Message-State: AEkoouuTj71P3knoRh8l3GvupOfUqFVthJfUGfPnbKdaJ2LTJMtwva1aCNVcDJ+wQp442hy/UsHKnXZ5EHGQQA==
X-Received: by 10.159.36.108 with SMTP id 99mr10792287uaq.79.1471936008614; Tue, 23 Aug 2016 00:06:48 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.159.37.1 with HTTP; Tue, 23 Aug 2016 00:06:48 -0700 (PDT)
In-Reply-To: <CADVnQym-wP=7pgSQ3ziWS-WmU9T-q2NVr1XSpB5ZkYOD8NYbAA@mail.gmail.com>
References: <MWHPR11MB1374A50BC599B093EA09668984070@MWHPR11MB1374.namprd11.prod.outlook.com> <7070553C-65D1-46EE-95F4-DAE82E1F5A5E@weston.borman.com> <CY4PR11MB187848FCCEF4DB140F85913E841A0@CY4PR11MB1878.namprd11.prod.outlook.com> <2D524A8D-A5CA-45A6-B94D-FA1DA0CEE609@weston.borman.com> <CY4PR11MB1878E7E911194A1032E32428841E0@CY4PR11MB1878.namprd11.prod.outlook.com> <CAO249yeTNRFuFcWn5ga854g24GM_7DAjeKOSw3d7h=HQQYKX1Q@mail.gmail.com> <CADVnQymeyst9De4F8Zqc6wGfLEdzmGsypSC-ZKZ7bXT6PO=J4g@mail.gmail.com> <CAO249yeeEo3B9H3SyGqA8aiWOWjoHYji=JXEh1GHOHSsf+RszA@mail.gmail.com> <CADVnQym-wP=7pgSQ3ziWS-WmU9T-q2NVr1XSpB5ZkYOD8NYbAA@mail.gmail.com>
From: Yoshifumi Nishida <nishida@sfc.wide.ad.jp>
Date: Tue, 23 Aug 2016 00:06:48 -0700
X-Gmail-Original-Message-ID: <CAO249ydtAPCa2U4A19r6bRUDXsEuGJ-bcN_yQHLQ9q6MDW8URQ@mail.gmail.com>
Message-ID: <CAO249ydtAPCa2U4A19r6bRUDXsEuGJ-bcN_yQHLQ9q6MDW8URQ@mail.gmail.com>
To: Neal Cardwell <ncardwell@google.com>
Content-Type: multipart/alternative; boundary="001a113d1268ed3477053ab7ced2"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tcpm/sEnh0C2_XKiIFww1hm9kNA7aDzs>
Cc: Kobby Carmona <kobby.Carmona@qlogic.com>, "tcpm@ietf.org" <tcpm@ietf.org>, David Borman <dab@weston.borman.com>
Subject: Re: [tcpm] Possible deadlock scenario with retransmission on both sides at the same time
X-BeenThere: tcpm@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: TCP Maintenance and Minor Extensions Working Group <tcpm.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tcpm>, <mailto:tcpm-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tcpm/>
List-Post: <mailto:tcpm@ietf.org>
List-Help: <mailto:tcpm-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tcpm>, <mailto:tcpm-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Aug 2016 07:06:54 -0000

Hi Neal,

Oh. I see. Thanks for the explanation.
I'd like to think about it a bit more.
Thanks,
--
Yoshi

On Sun, Aug 21, 2016 at 12:44 PM, Neal Cardwell <ncardwell@google.com>
wrote:

> I am pretty sure Linux does not have the issue Kobby pointed out in this
> thread.
>
> At a high level Linux should be OK because it follows the principle
> David Borman laid out in his August 16 email: "ACK-only packets should
> be sent with the largest in-window sequence number that has ever been
> sent."
>
> Linux obeys that principle by using tp->snd_nxt to store the largest
> sequence number that has ever been sent, and having
> tcp_acceptable_seq() use tp->snd_nxt but clamp the outgoing sequence
> number to make sure it is in-window. To be able to do this, in Linux,
> the sender does not rewind tp->snd_nxt on retransmissions.
>
> neal
>
> On Sun, Aug 21, 2016 at 1:25 PM, Yoshifumi Nishida
> <nishida@sfc.wide.ad.jp> wrote:
> > Hi Neal,
> >
> > Thanks for the info.
> > So, it seems to me that the linux code has the issue Kobby pointed out.
> > Or, am I missing something?
> > --
> > Yoshi
> >
> >
> > On Mon, Aug 15, 2016 at 6:18 PM, Neal Cardwell <ncardwell@google.com>
> wrote:
> >>
> >> On Mon, Aug 15, 2016 at 6:39 PM, Yoshifumi Nishida
> >> <nishida@sfc.wide.ad.jp> wrote:
> >> > Hello,
> >> > I personally think this is an interesting corner case for discussion.
> >> > It looks a minor one, but I'm not not very sure if we can leave it for
> >> > each
> >> > implementation.
> >> > I also guess a question would be if the BSD's fix is the best way for
> >> > the
> >> > issue.
> >>
> >> Yes, I agree this is an interesting case for discussion.
> >>
> >> FWIW, as a point of comparison for discussion, Linux's approach is a
> >> little different: in Linux, the sender does not rewind SND.NXT on
> >> retransmissions (RTO or Fast Recovery). Then the sender usually uses
> >> SND.NXT for the seq field of outgoing pure ACKs. I say "usually"
> >> because the Linux code has some code to deal with the case where the
> >> receiver has withdrawn the receive window, so that SND.NXT is now
> >> beyond the receive window. The code tcp_send_ack() uses to pick a seq
> >> for outgoing pure ACKs looks like:
> >>
> >> /* SND.NXT, if window was not shrunk.
> >>  * If window has been shrunk, what should we make? It is not clear at
> >> all.
> >>  * Using SND.UNA we will fail to open window, SND.NXT is out of
> >> window. :-(
> >>  * Anything in between SND.UNA...SND.UNA+SND.WND also can be already
> >>  * invalid. OK, let's make this for now:
> >>  */
> >> static inline __u32 tcp_acceptable_seq(const struct sock *sk)
> >> {
> >>         const struct tcp_sock *tp = tcp_sk(sk);
> >>
> >>         if (!before(tcp_wnd_end(tp), tp->snd_nxt))
> >>                 return tp->snd_nxt;
> >>         else
> >>                 return tcp_wnd_end(tp);
> >> }
> >>
> >> neal
> >
> >
>