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

Jamie Lokier <jamie@shareable.org> Mon, 19 April 2010 12:10 UTC

Return-Path: <jamie@shareable.org>
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 B92A63A6A7F for <hybi@core3.amsl.com>; Mon, 19 Apr 2010 05:10:25 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.695
X-Spam-Level:
X-Spam-Status: No, score=-1.695 tagged_above=-999 required=5 tests=[AWL=-1.696, BAYES_50=0.001]
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 XoC7f9oz4oyJ for <hybi@core3.amsl.com>; Mon, 19 Apr 2010 05:10:24 -0700 (PDT)
Received: from mail2.shareable.org (mail2.shareable.org [80.68.89.115]) by core3.amsl.com (Postfix) with ESMTP id 9B80B3A6A1D for <hybi@ietf.org>; Mon, 19 Apr 2010 05:10:12 -0700 (PDT)
Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from <jamie@shareable.org>) id 1O3pnc-0000Sz-Ny; Mon, 19 Apr 2010 13:10:00 +0100
Date: Mon, 19 Apr 2010 13:10:00 +0100
From: Jamie Lokier <jamie@shareable.org>
To: Markus.Isomaki@nokia.com
Message-ID: <20100419121000.GG28758@shareable.org>
References: <4BCAB2C1.2000404@webtide.com> <B9DC25B0-CD21-44E7-BD9B-06D0C9440933@apple.com> <Pine.LNX.4.64.1004181812370.751@ps20323.dreamhostps.com> <4BCB6641.70408@webtide.com> <Pine.LNX.4.64.1004182010070.751@ps20323.dreamhostps.com> <4BCB6FD0.7080003@webtide.com> <j2n5c4444771004181403o81184b00r294f3c3b878f24f6@mail.gmail.com> <20100419091736.GA28758@shareable.org> <p2w2a10ed241004190222ne3a61417i47b021dbe0422f71@mail.gmail.com> <B3F72E5548B10A4A8E6F4795430F841832040920C4@NOK-EUMSG-02.mgdnok.nokia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <B3F72E5548B10A4A8E6F4795430F841832040920C4@NOK-EUMSG-02.mgdnok.nokia.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
Cc: hybi@ietf.org
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: Mon, 19 Apr 2010 12:10:25 -0000

Markus.Isomaki@nokia.com wrote:
>    Unfortunately, I bet may NATs just drop the connection without
>    notifying the endpoints (e.g. never sends a RST).

Correct.  I've never seen a NAT send a RST.

In fact they *can't* send RST if the drop is due to routing update or
equipment reboots / failure.

Automatic routing updates are the most annoyingly subtle, because
typically nobody realises there's a problem, only that connections
drop from time to time.

>    This could become problematic for websockets, I'm not sure.

Yes, it will, unless applications use timeouts and automatic
reconnection.

>    Keepalives may help some,

Keepalives have two roles, and they actually have *distinct* timing
requirements:

    1. To tell NATs / SPIs / TCP relays / HTTP proxies (CONNECT)
       not to drop the connection.

    2. To tell the client application that the connection is still
       present so it knows when to abort and make a *new* connection.

The timeout needed for 1 is typically larger than the timeout for 2
but it depends on the app.

1 is network dependent; 2 is application dependent.
   
>    but I bet NATs are smart enough to break even there too.  Data is
>    needed....

I can give you personal experience.  Yes: NATs do break connections
with traffic on them.

   - I see about 1000 such breakages very day, admittedly on the same
     corporate national private network.

   - I see them occasionally elsewhere when connecting to servers.

   - Whenever a router is rebooted, this happens.
     This happens a lot in some houses with flaky ADSL routers.
     Even Apple's kit...

     (A very few routers are smart enough to persist NAT state across
     reboots, but it's rare, and I've never heard of it in a home router.)

>    I agree this is an important point. If I'm writing an application on
>    top of the WebSocket API, is it my responsibility to deal with
>    keepalives and connection failures due to NAT timer resets or reboots,
>    or does the protocol do somethig for me in this regard? I suppose the
>    current draft (-75) is pretty silent on this, which means it's all up
>    to the application programmer. That sounds a bit unreasonable if we
>    want the app development to be really simple. Probably, even if the
>    app developers figured out how to do it, they probably would not do it
>    in an optimal manner. So, I suppose it would be good to have either an
>    extension (or a subprotocol) to deal with this. At least it's a piece
>    of code that all client side apps will need anyway. I am not sure to
>    which level it needs to be standardized, but there has to be some way
>    to get it done.
> 
>    Is this still an open issue or has it been discussed and resolved in
>    some way already?

It is still being debated with no clear tracking and no resolution in sight.

There is currently no consensus on whether the application should
handle these network issues itself, or if the WebSocket implementation
should play a role.

Approximate divide: Browser implementers and WHATWG editors { ;-) }
appear to prefer the application handles these issues or ignores them
as it chooses choose, so that WebSocket implementation itself is simple.

Proxy and server implementers seem to prefer that WebSockets handles
it, so application programmers get a robust pipe without having to deal
with these issues (and it might use the network a bit better).

The current draft's direction is to push it to the application
programmer, either to keep WebSocket itself simple, or to make it a
thin wrapper around TCP (even though it's quite unlike TCP).

I suspect some supporters of latter approach are still thinking of the
80s and early 90s when a TCP connection was a reliable byte pipe.  It
isn't any more (it never was but the issues are more widespread now.)

-- Jamie