Re: [hybi] Reliable message delivery (was Re: Technical feedback.)

Jamie Lokier <jamie@shareable.org> Sat, 30 January 2010 14:09 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 3238F3A67B0 for <hybi@core3.amsl.com>; Sat, 30 Jan 2010 06:09:59 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[AWL=0.698, BAYES_00=-2.599]
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 R1go+ye8ppkz for <hybi@core3.amsl.com>; Sat, 30 Jan 2010 06:09:58 -0800 (PST)
Received: from mail2.shareable.org (mail2.shareable.org [80.68.89.115]) by core3.amsl.com (Postfix) with ESMTP id 28AC33A672E for <hybi@ietf.org>; Sat, 30 Jan 2010 06:09:58 -0800 (PST)
Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from <jamie@shareable.org>) id 1NbE1k-0002yQ-JT; Sat, 30 Jan 2010 14:10:20 +0000
Date: Sat, 30 Jan 2010 14:10:20 +0000
From: Jamie Lokier <jamie@shareable.org>
To: Maciej Stachowiak <mjs@apple.com>
Message-ID: <20100130141020.GC19124@shareable.org>
References: <bbeaa26f1001281449q1a6e1813q3f537fe15a5a9d60@mail.gmail.com> <4B625733.2020907@webtide.com> <6.2.5.6.2.20100128225542.06fa8d68@resistor.net> <Pine.LNX.4.64.1001290817520.22020@ps20323.dreamhostps.com> <4B62C5FE.8090904@it.aoyama.ac.jp> <Pine.LNX.4.64.1001291134350.22020@ps20323.dreamhostps.com> <4B62E516.2010003@webtide.com> <5c902b9e1001290756r3f585204h32cacd6e64fbebaa@mail.gmail.com> <4B636757.3040307@webtide.com> <8449BE19-3061-4512-B563-02973FBB707B@apple.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <8449BE19-3061-4512-B563-02973FBB707B@apple.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] Reliable message delivery (was Re: Technical feedback.)
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: Sat, 30 Jan 2010 14:09:59 -0000

Maciej Stachowiak wrote:
> I'm curious about a couple of things:
> 

> 1) Do OS TCP stacks expose enough information to socket-level
> clients to determine what has definitely been sent when a TCP
> connection is closed?

In general, no they don't.  Linux does, but even then you have to poll
the statistics rather than waiting for an ack event.

There is a related issue, which is evident in Apache's
code and is a flaw in HTTP we'd do well not to repeat.
That is: It's not safe to close 


> 2) Is a TCP-level ack sufficient for this purpose? (Or would clients
> for reliable message delivery want a full end-to-end ack from the
> receiving application?)

No, and yes.  The reasons are numerous:

  - There are many kinds of TCP-level intermediaries
    which listen on a port, and for each incoming connection,
    create an outgoing connection elsewhere and simply relay
    octets both ways.  They do not interpret HTTP at all.

      + For example, SSH is sometimes used to establish the above
        type of proxy; in SSH it is called tunnelling.  There
        is other software which tunnels in this way.

      + Some routing/forwarding techniques, and some bandwidth
        management devices do it.

      + Ironically, sometimes it is used to avoid an intercepting HTTP
        proxy that is causing problems. :-)

      + Some mobile / wireless / satellite system relays do the
        same thing, because it allows different TCP algorithms to
        be used for the wireless link, which are better suited
        to the channel characteristics (e.g. high loss, fading).

  - Forwarding over HTTP proxies, for example using CONNECT on port
    443 is described in the WebSocket draft.

  - Forwarding over HTTP proxies that implement WebSocket
    detection and forwarding.  Not yet, but to be expected if
    it's deployed.

  - Forwarding by HTTP proxies that switch into "tunnelling mode"
    when they see something they cannot parse.  I am told these exist,
    because they are more reliable than strict proxies and it's needed
    due to a certain amount of badly non-compliant HTTP out there
    (e.g. header names containing spaces and quote marks).

    Some of these are intercepting "invisible"/"stealth" proxies and
    do not insert Via headers.  These proxies may end up forwarding
    WebSocket despite it's attempt to detect them.

  - Data that has been acknowledged by TCP ACK is not sent to the
    application under some circumstances:

      + The application calls close() or shutdown(SHUT_RD) between the
        data being sent and before it has read the data.  This
        window is unavoidable, because OSes generally don't allow
        applications to read any data that was buffered at that
        precise moment.

      + The network facing component crashes, is terminated,
        is taken offline etc.  For example, restarting cometd.
        Even though communication is nominally with another
        component *behind* the network facing one, which is still
        running.  This is just another kind of proxy.

-- Jamie