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

Neal Cardwell <ncardwell@google.com> Tue, 16 August 2016 01:19 UTC

Return-Path: <ncardwell@google.com>
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 9C0C712D58A for <tcpm@ietfa.amsl.com>; Mon, 15 Aug 2016 18:19:19 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.948
X-Spam-Level:
X-Spam-Status: No, score=-3.948 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RP_MATCHES_RCVD=-1.247, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=google.com
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 2H8IcDA0LrKa for <tcpm@ietfa.amsl.com>; Mon, 15 Aug 2016 18:19:18 -0700 (PDT)
Received: from mail-oi0-x22e.google.com (mail-oi0-x22e.google.com [IPv6:2607:f8b0:4003:c06::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5418412D586 for <tcpm@ietf.org>; Mon, 15 Aug 2016 18:19:18 -0700 (PDT)
Received: by mail-oi0-x22e.google.com with SMTP id 4so81280068oih.2 for <tcpm@ietf.org>; Mon, 15 Aug 2016 18:19:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ZqX4IdRpbXKXt9+KCdEQniYvitWLkFXL+EmWmOqqVoo=; b=k/JgeBbJceXxB8QDkqLItj5Qt2hL8+t9ykUBU0MyiaXAEEMkNtElreOJKTZSWwAK6L vQX9AzQ2XygtMtBBjB1mB3TsKRHW3LaQLXYVqpqiPdS2342rGVpPaTIrCOrsZ4rwIBk4 KJX92up63BdWlOqgZ3bxqeJoOSO8jdCTusGGmom+63NmgY7J6StKr8Bt3GEIucimdLSO n7BKorbpgwIF5FvONnmJ4Ki7lcQtAbZrW2kEgIRUQgELsdCmD54ndEnQ2fY/wB1tTBR9 OGXl5TvmbRbd6VNRNUrXG2tydF8j/8vdfBDKsia8ZQ44iNKf50a0oH8faz0SHOVKNnIy 3a5A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ZqX4IdRpbXKXt9+KCdEQniYvitWLkFXL+EmWmOqqVoo=; b=kz/FX1+3bOgKQL+FlpcesJapCTHJI6bI4siEa86eYMAwlDJqCfCS/IPHLZ3BPba4B9 xC2onEoVFiSbYNuSlKGk2NoYpkaRBaMMUFc2iSnJtaKfoiSWGTfAfIU5Dww7xd6ytlhd jOj4QDaJ0/wHLjXX0VBpZyBshN6whN7i2Ndfz85nnT1fsp/9/TaKDdzP2eBQ6cVb0zql MNuiWD4WbAdQWAK+z7vgheSdNYbw8a0UqQG/Dt8uSHCN4SInBe0t5FsOIgyN0lRhveCu wsdacISFutHtiosKsO2EFIaC8jJ2AG7Bhb8VJSDXiYb2v+OQBiXsOAOIXYa+0890ZxBs R/tw==
X-Gm-Message-State: AEkoouvsxDpeHWBNArhsVVLDwRseMsw1SOMDXThZ5VQmYinhOSdY4vCH8huDXgi0jN4Lh0lvQJ+nMlOWuSWReEQB
X-Received: by 10.157.34.135 with SMTP id y7mr2301342ota.111.1471310357565; Mon, 15 Aug 2016 18:19:17 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.202.92.194 with HTTP; Mon, 15 Aug 2016 18:18:47 -0700 (PDT)
In-Reply-To: <CAO249yeTNRFuFcWn5ga854g24GM_7DAjeKOSw3d7h=HQQYKX1Q@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>
From: Neal Cardwell <ncardwell@google.com>
Date: Mon, 15 Aug 2016 21:18:47 -0400
Message-ID: <CADVnQymeyst9De4F8Zqc6wGfLEdzmGsypSC-ZKZ7bXT6PO=J4g@mail.gmail.com>
To: Yoshifumi Nishida <nishida@sfc.wide.ad.jp>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tcpm/2h2yzLYVCFPX5VKh93dMsBJyo0k>
Cc: Kobby Carmona <kobby.Carmona@qlogic.com>, David Borman <dab@weston.borman.com>, "tcpm@ietf.org" <tcpm@ietf.org>
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, 16 Aug 2016 01:19:19 -0000

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