Re: [quicwg/base-drafts] Include ack_delay when deciding with PN space to arm PTO for (#3666)

Martin Thomson <notifications@github.com> Tue, 19 May 2020 00:45 UTC

Return-Path: <noreply@github.com>
X-Original-To: quic-issues@ietfa.amsl.com
Delivered-To: quic-issues@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 2A7923A0DB1 for <quic-issues@ietfa.amsl.com>; Mon, 18 May 2020 17:45:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.201
X-Spam-Level:
X-Spam-Status: No, score=-1.201 tagged_above=-999 required=5 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, MAILING_LIST_MULTI=-1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=github.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 xXTslXfEyKuW for <quic-issues@ietfa.amsl.com>; Mon, 18 May 2020 17:45:01 -0700 (PDT)
Received: from out-24.smtp.github.com (out-24.smtp.github.com [192.30.252.207]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 063E13A0D94 for <quic-issues@ietf.org>; Mon, 18 May 2020 17:45:00 -0700 (PDT)
Received: from github-lowworker-c53a806.ac4-iad.github.net (github-lowworker-c53a806.ac4-iad.github.net [10.52.23.45]) by smtp.github.com (Postfix) with ESMTP id 315CC6A0A58 for <quic-issues@ietf.org>; Mon, 18 May 2020 17:45:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1589849100; bh=gbJ+jRhTD5g6YIX0G4nFNDSdJataAWd8EwFf3k8ZjWs=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:List-ID: List-Archive:List-Post:List-Unsubscribe:From; b=TR6xBJ3EPq8qj1l5pNJquNZHfDqjmr2sOXRx4/AAgWim3oG/3DM7xDmDyHJXW6CBt lHtw4ZEnVCJGmpNVcysi4SZqFjRdwh/Zui0Sm7Zuew+XTk38O/vZT8+lFm/EiE6j0s moEy7DcUYFfMBdcLpSSKXB8SaZFIWlzfaXNP0CX4=
Date: Mon, 18 May 2020 17:45:00 -0700
From: Martin Thomson <notifications@github.com>
Reply-To: quicwg/base-drafts <reply+AFTOJK3R2ASUKP4LCKVRIJ54Z4GQZEVBNHHCJ5SAW4@reply.github.com>
To: quicwg/base-drafts <base-drafts@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Message-ID: <quicwg/base-drafts/pull/3666/review/414027013@github.com>
In-Reply-To: <quicwg/base-drafts/pull/3666@github.com>
References: <quicwg/base-drafts/pull/3666@github.com>
Subject: Re: [quicwg/base-drafts] Include ack_delay when deciding with PN space to arm PTO for (#3666)
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="--==_mimepart_5ec32c0c210e8_75f43f95eb0cd968112124"; charset=UTF-8
Content-Transfer-Encoding: 7bit
Precedence: list
X-GitHub-Sender: martinthomson
X-GitHub-Recipient: quic-issues
X-GitHub-Reason: subscribed
X-Auto-Response-Suppress: All
X-GitHub-Recipient-Address: quic-issues@ietf.org
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic-issues/SMcP6Fr8_HQaj0gq2y0dm6BOvJA>
X-BeenThere: quic-issues@ietf.org
X-Mailman-Version: 2.1.29
List-Id: Notification list for GitHub issues related to the QUIC WG <quic-issues.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/quic-issues>, <mailto:quic-issues-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/quic-issues/>
List-Post: <mailto:quic-issues@ietf.org>
List-Help: <mailto:quic-issues-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/quic-issues>, <mailto:quic-issues-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 19 May 2020 00:45:03 -0000

@martinthomson commented on this pull request.

One large comment.  Bottom line is that I don't think that this pseudocode is doing a great job of communicating here.  Also, this is a functional change to the outcome in more ways that the subject of the PR implies.

> +  // Calculate PTO duration, sent_time includes max_ack_delay.
+  timeout = smoothed_rtt + max(4 * rttvar, kGranularity)

Not that it was great before, but I think that this change obfuscates things.

I think that the inclusion of the max_ack_delay argument overloads GetEarliestTimeAndSpace in a way that just highlights how the dual purpose to which the function is applied is not appropriate.

We use this function for working out two things:
* when to declare something lost
* when the PTO timer should start 

The former is not affected by max_ack_delay.   The PTO calculation is, but this change adds max_ack_delay to the baseline rather than the PTO calculation itself.

For one, that's a fundamental change in logic for one (because PTO number 2 used to include 2*max_ack_delay and now it doesn't. Maybe that was a bug that this fixes, but that needs to be clear.

However, the main problem is the way that this code now communicates its intent.  If the intent is to start with a baseline (t_sent) and to add a PTO (RTT + 4*rttvar) that is then doubled each time, and only then compensate for ACK delay, you want to show your work, not hide it:

```
pto_timer = smoothed_rtt + max(4 * rttvar, kGranularity)
pto_timer *= 1 << pto_count
loss_detection_timer.update(sent_time + pto_timer + ?max_ack_delay)
```
Or is it, with maybe a fix for the packet number space issue...
```
pto_timer = smoothed_rtt + max(4 * rttvar, kGranularity) + ?max_ack_delay
pto_timer *= 1 << pto_count
loss_detection_timer.update(sent_time + pto_timer)
```

The trick is that the code that triggers SendOneOrTwoAckElicitingPackets() needs to follow the same logic.  But that too is too clever.  Basing that on the reference time (the time you sent the last packet) rather than the time that the timer is expected to pop is obtuse (even if it is correct as you currently formulate it).

Why not provide a CalculatePtoTime() function and use that?  This code doesn't need to be optimized, so you can calculate everything always.

```python
pto_time = { Initial: 0, Handshake: 0, ApplicationData: 0 };
for space in time_of_last_sent_ack_eliciting_packet:
    if time_of_last_sent_ack_eliciting_packet[space] == 0:
        continue;
    t = smoothed_rtt + max(4 * rttvar, kGranularity)
    t = t * (2 ^ pto_count)
    if space == ApplicationData: # or move this up as you need
        t += max_ack_delay
    pto_time[space] = time_of_last_sent_ack_eliciting_packet[space] + t
pto_time, pn_space = GetEarliestTimeAndSpace(pto_time)
```

This needs tweaking for the case where sent_time == 0, but that is just a case of factoring out the PTO interval calculation.  Note that you aren't adding max_ack_delay in that case, which is another difference.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/pull/3666#pullrequestreview-414027013