Re: [hybi] NAT reset recovery? Was: Extensibility mechanisms?

Dave Cridland <dave@cridland.net> Tue, 20 April 2010 10:13 UTC

Return-Path: <dave@cridland.net>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 172E03A6BBB for <hybi@core3.amsl.com>; Tue, 20 Apr 2010 03:13:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.74
X-Spam-Level:
X-Spam-Status: No, score=-0.74 tagged_above=-999 required=5 tests=[BAYES_20=-0.74]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v6Kr6miLg414 for <hybi@core3.amsl.com>; Tue, 20 Apr 2010 03:13:46 -0700 (PDT)
Received: from peirce.dave.cridland.net (peirce.dave.cridland.net [IPv6:2001:470:1f09:882:2e0:81ff:fe29:d16a]) by core3.amsl.com (Postfix) with ESMTP id 0FB3B28C16C for <hybi@ietf.org>; Tue, 20 Apr 2010 03:04:44 -0700 (PDT)
Received: from localhost (localhost.localdomain [127.0.0.1]) by peirce.dave.cridland.net (Postfix) with ESMTP id 4BD4211680AF; Tue, 20 Apr 2010 11:04:35 +0100 (BST)
X-Virus-Scanned: Debian amavisd-new at peirce.dave.cridland.net
Received: from peirce.dave.cridland.net ([127.0.0.1]) by localhost (peirce.dave.cridland.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3Z+0QgWHhoHb; Tue, 20 Apr 2010 11:04:25 +0100 (BST)
Received: from Sputnik (unknown [62.3.217.253]) by peirce.dave.cridland.net (Postfix) with ESMTPA id D41CA11680AA; Tue, 20 Apr 2010 11:04:25 +0100 (BST)
References: <20100419091736.GA28758@shareable.org> <B3F72E5548B10A4A8E6F4795430F841832040920C4@NOK-EUMSG-02.mgdnok.nokia.com> <20100419121000.GG28758@shareable.org> <87764B8E-5872-40EE-AA2F-D4E659B94F63@d2dx.com> <20100419140423.GC3631@shareable.org> <6959E9B3-B1AC-4AFB-A53D-AB3BA340208C@d2dx.com> <B3F72E5548B10A4A8E6F4795430F841832040F78C0@NOK-EUMSG-02.mgdnok.nokia.com> <w2q5821ea241004191309t7362de42p922788d380119dc4@mail.gmail.com> <B3F72E5548B10A4A8E6F4795430F841832040F78DB@NOK-EUMSG-02.mgdnok.nokia.com> <20100420013220.GC21899@shareable.org> <l2s5821ea241004192301u692d2344y8da146470a68ab75@mail.gmail.com> <8B0A9FCBB9832F43971E38010638454F03E7D06A36@SISPE7MB1.commscope.com> <B3F72E5548B10A4A8E6F4795430F841832040F7B57@NOK-EUMSG-02.mgdnok.nokia.com>
In-Reply-To: <B3F72E5548B10A4A8E6F4795430F841832040F7B57@NOK-EUMSG-02.mgdnok.nokia.com>
MIME-Version: 1.0
Message-Id: <4991.1271757865.754227@Sputnik>
Date: Tue, 20 Apr 2010 11:04:25 +0100
From: Dave Cridland <dave@cridland.net>
To: "Markus.Isomaki@nokia.com" <Markus.Isomaki@nokia.com>, Server-Initiated HTTP <hybi@ietf.org>, "Thomson, Martin" <Martin.Thomson@andrew.com>, Pieter Hintjens <ph@imatix.com>, Jamie Lokier <jamie@shareable.org>
Content-Type: text/plain; delsp="yes"; charset="us-ascii"; format="flowed"
Subject: Re: [hybi] NAT reset recovery? Was: Extensibility mechanisms?
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 20 Apr 2010 10:13:48 -0000

On Tue Apr 20 07:50:56 2010, Markus.Isomaki@nokia.com wrote:
> I would not want to make the keepalives peer-to-peer in a sense  
> that also the server could send keepalives. I think the client  
> should be in charge. The reason is that as a client developer for a  
> mobile device I would like to be able to send keepalives as  
> infrequently as possible. We have had some bad experiences with  
> IMAP servers sending stuff frequently back to the client  
> (presumably because not all clients are clever enough to do any  
> keepalives themselves - this is a risk of course if we don't  
> specify this at all in websocket spec), and the client has no way  
> to affect their rate, which has been fixed.

I've seen this work in two different ways.

First, in IMAP, we've found that the client needs to be in control,  
as it often knows better - however, others (including Mark Crispin)  
found that having the server send keepalives when it'd otherwise be  
shutting down the session is useful. Note that in IMAP, there are  
technically no actual keepalives, but servers can send an ignorable  
"* OK", and in extreme cases, can fake a delivery to cause a client  
to do something. Clients have a NOOP command. I suspect a lot of the  
issues with IMAP relate to there being no simple way for the server  
to ping the client built-in to the protocol.

In XMPP, however, we've found that having the ability to ping the  
client from the server is very useful. In XMPP, there's two distinct  
protocol features which enable TCP-level keepalive. Firstly, either  
side may send a SP character between stanzas. Secondly, each side may  
actually ping the other. Having the server send a SP on an idle  
session is useful for defeating NAT timeouts, whereas the ping  
(XEP-0199) is extremely useful to definitively check reachability.

> If there really is a requirement for the server to see keepalives  
> at a certain minimum rate (for instance so that it can abandon  
> stale connections), I would then have that negotiated so that the  
> server can tell that back to the client who would still do the  
> sending. But I'm not sure if that's needed.

I think we need all cases possible, then some sensible advice to  
implementors. In the XSF, we've learned a lot about how to defeat NAT  
timeouts and get early failure detection, and the main thing we've  
learned is that things change - only a year or two back using  
long-lived TCP over mobile networks was really difficult, whereas now  
it's much better.

What's more interesting, to me, is what to do if the connection does  
break.

If each connection is granted an identifier, and - moreover - the  
client can request a specific identifer to be reattached during the  
HTTP Upgrade negotiation at a known sequence point, then in principle  
a WebSocket needn't be conceptually broken even if connectivity is  
entirely lost due to a NAT reboot.

Something very similar happens with XEP-0198, where XMPP clients can  
reacquire a running XMPP session after TCP is lost.

Dave.
-- 
Dave Cridland - mailto:dave@cridland.net - xmpp:dwd@dave.cridland.net
  - acap://acap.dave.cridland.net/byowner/user/dwd/bookmarks/
  - http://dave.cridland.net/
Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade