Re: QUIC Connection Close Reliability

Martin Thomson <martin.thomson@gmail.com> Wed, 25 April 2018 10:14 UTC

Return-Path: <martin.thomson@gmail.com>
X-Original-To: quic@ietfa.amsl.com
Delivered-To: quic@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id F320912DA1D for <quic@ietfa.amsl.com>; Wed, 25 Apr 2018 03:14:06 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 9hUIeS-1YT8u for <quic@ietfa.amsl.com>; Wed, 25 Apr 2018 03:14:04 -0700 (PDT)
Received: from mail-ot0-x22d.google.com (mail-ot0-x22d.google.com [IPv6:2607:f8b0:4003:c0f::22d]) (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 1B21612DA28 for <quic@ietf.org>; Wed, 25 Apr 2018 03:14:02 -0700 (PDT)
Received: by mail-ot0-x22d.google.com with SMTP id t1-v6so4772996oth.8 for <quic@ietf.org>; Wed, 25 Apr 2018 03:14:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=zZnZsLNxGTiuwmyjBHZUPxU7sxUDGP9cnHdVmuPF68U=; b=uXrFLrht3NnV4F8Uvh8zc6qxIIIKvG9UWAdrr2vjQIdz98yHGQ3SQz9FhNsxoO7/dn srKWrxUkXVPGY/1qyfFOCoHTMIwBSzynBOrzx3xrVmvAeb04IcUR/QUW0eASkRc7Vrh1 1l3XG73VN9uyd07+C0M9zoa/d5NebJsDbnyl1RqJgGz5iCettUJwhvN8jf/mFYcAt7Ee dsLrhdDAZZ3B12nxNlHxysCXdhpgzltFrIueehuNF69us8Zx6RPRUySzopNiimMZTMdp FOxih62Tkc0j8kNaFFE35Yfb5uC/0H6Lpa/UIh1BbPyWEFX2c1IKj/zAKybkbtifCwwq gahA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=zZnZsLNxGTiuwmyjBHZUPxU7sxUDGP9cnHdVmuPF68U=; b=PmpLkvwpfcIgYPmxdCARwZ/Npmrwa5JVcmkWqICldYC+NiZ0OaCw7JakTUWULJCxJ4 2yqDHVOAUfCHQo+rzqHi+dCq7yN2aLmlKVpN1dMkfDVlVcdh5EJT8s7aYs1JXcjKgu2m nxg0Dp9ACTPR4eYy1ttQZBOFlkqWWMkwIWoxHpzO5YcrcTLMTUygU54mwejUs8nCMtrq F4m6Qwg2anbxCfNtH8vlj7ow5jNXium9PIop7ND99I1W4xYaN1WIYYnFZQp5TgrrnJ+X fIIlu5dOC0xuu3nI83ycoz5yReSeeHeaNNpFrJT2vUcAz/KFIDoZpWll5AGhxBkDCuTK pvWA==
X-Gm-Message-State: ALQs6tAxRWkW8ZfgiOjO4v7prpSQqMS74UfLbY2N5x27e1LXwoZiRhXH szc4PferPUIZFZuSeXC6go7MePN51WCJcx5JmzdIkQ==
X-Google-Smtp-Source: AB8JxZqJnTw6ddR3/ylFreSrWK8JhQ+71+sJxrp/oDo+N1Re32km6vd4EaH7AJTcYdqwdTw3l5/kl02LZUzJwKryt3k=
X-Received: by 2002:a9d:501e:: with SMTP id a30-v6mr5090845oth.15.1524651241196; Wed, 25 Apr 2018 03:14:01 -0700 (PDT)
MIME-Version: 1.0
Received: by 2002:a9d:29ce:0:0:0:0:0 with HTTP; Wed, 25 Apr 2018 03:14:00 -0700 (PDT)
In-Reply-To: <DM5PR2101MB090161AA6FD645EFFA1A1EFBB3890@DM5PR2101MB0901.namprd21.prod.outlook.com>
References: <DM5PR2101MB090161AA6FD645EFFA1A1EFBB3890@DM5PR2101MB0901.namprd21.prod.outlook.com>
From: Martin Thomson <martin.thomson@gmail.com>
Date: Wed, 25 Apr 2018 12:14:00 +0200
Message-ID: <CABkgnnVOaOh8AsPAubvXwZe4G3SC-NSoaj0ePaxuHea0kaXw=Q@mail.gmail.com>
Subject: Re: QUIC Connection Close Reliability
To: Nick Banks <nibanks=40microsoft.com@dmarc.ietf.org>
Cc: IETF QUIC WG <quic@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/LsUvGOZW-AIX-Uz9vXJwz-yDSig>
X-BeenThere: quic@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Main mailing list of the IETF QUIC working group <quic.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/quic>, <mailto:quic-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/quic/>
List-Post: <mailto:quic@ietf.org>
List-Help: <mailto:quic-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/quic>, <mailto:quic-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 25 Apr 2018 10:14:07 -0000

Hi Nick,

It seems that you are having a problem with getting agreement between
peers about what the close state is.  In your example, if A cares that
the stream was completely received by B, then this is not an
appropriate way to negotiate a close in that application protocol.

You might interpret the receipt of APPLICATION_CLOSE as implicit
acknowledgment of all streams to avoid this particular problem, or to
create additional signals.

HTTP over QUIC does this largely by driving this from the client end,
which simplifies things considerably.

On Tue, Apr 24, 2018 at 12:06 AM, Nick Banks
<nibanks=40microsoft.com@dmarc.ietf.org> wrote:
> Hey Folks,
>
>
>
> I have been trying to work through an issue with reliability, related to
> connection close and I am trying to understand if this is a protocol issue
> for if I need to change my implementation.
>
>
>
> Suppose you have an application protocol on top of QUIC where each side of
> the connection may use one or more streams and then immediately, but
> gracefully, close the connection when they are done with all the streams. In
> that kind of application protocol, one side of the connection generally ends
> up closing immediately in response to receiving a FIN on a stream. Then you
> get into a state where the peer won’t necessarily get that FIN acknowledged.
> Even if the endpoint sends an acknowledgment for the FIN (either as a
> separate packet or with the close) it’s possible that ACK is lost. Ideally
> (I think), the ACK is sent in the same packet as the close, so you can
> control the atomic state change on the peer. If the ACK was separate, and
> lost, but the close wasn’t lost, then the peer would treat the stream as
> abortively closed.
>
>
>
> A -------- STREAM (w/FIN) ------> B
>
> A <------- ACK, APP_CLOSE ------- B
>
>
>
> But now the issue comes if the ACK/APP_CLOSE packet is lost. Per spec, the
> endpoint (B) that received the FIN and then closed the connection enters the
> closing period. While in this state, the spec states that the endpoint
> SHOULD respond to any packet it receives [without a corresponding close
> frame] with another packet containing a closing frame. If the endpoint does
> this, and includes the ACK again as well, I believe everything would work.
> The peer (A) would retransmit the STREAM packet, which would elicit a new
> ACK/APP_CLOSE packet from (B). My fear though (from current interop
> experience) is that everyone will try to short circuit connection closure
> and just immediately go away. If this behavior isn’t completely standard
> across all implementations, then the application protocol would end up
> having different results on different implementations. Some implementations,
> might not send the ACK at all with the initial close, causing the peer (A)
> to most of the time interpret the stream as aborted. Other times, the
> endpoint (A) might not continue to send the ACK frame with the close, or
> just not send anything any more at all, resulting in a timeout on the peer
> side, also resulting in an abortive closure of the stream. This would
> probably cause the application protocol to end up creating it’s own close
> semantics, on top of QUIC.
>
>
>
> Now, folks might not think this is a very important scenario, but I feel we
> should aim for consistency here. Perhaps I have missed a different solution
> to the problem. I considered a design that always sends that last ACK with a
> PING frame, and waits for that to get acknowledged before closing, but I
> felt it was way too ugly.
>
>
>
> Thanks,
>
> - Nick