Re: [hybi] New port and Tunneling?

Vladimir Katardjiev <vladimir@d2dx.com> Tue, 17 August 2010 08:01 UTC

Return-Path: <vladimir@d2dx.com>
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 9367E3A6822 for <hybi@core3.amsl.com>; Tue, 17 Aug 2010 01:01:41 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[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 Qrym4ZUJ0pgd for <hybi@core3.amsl.com>; Tue, 17 Aug 2010 01:01:40 -0700 (PDT)
Received: from homiemail-a6.g.dreamhost.com (caiajhbdccac.dreamhost.com [208.97.132.202]) by core3.amsl.com (Postfix) with ESMTP id 40E803A6877 for <hybi@ietf.org>; Tue, 17 Aug 2010 01:01:40 -0700 (PDT)
Received: from homiemail-a6.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a6.g.dreamhost.com (Postfix) with ESMTP id 0043B598070; Tue, 17 Aug 2010 01:02:15 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=d2dx.com; h=subject:mime-version :content-type:from:in-reply-to:date:cc:message-id:references:to; q=dns; s=d2dx.com; b=VeRQP1lR0OWYhSJvUIGj5oW6vLRwrVhFlH0tPW/g+Y g5ZBoMtzpIGuRotuV+gXQMvHV33Y1UsxYmH4HPcBjPo5/PUIsY5MOVxUUvEVbZS8 rHZR75bekg+pv3bbq02pGHit+N94YqjQk2RaQq1kP5+UUk1lBGBA7XXtU1+tp/uL c=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=d2dx.com; h=subject :mime-version:content-type:from:in-reply-to:date:cc:message-id :references:to; s=d2dx.com; bh=jxKwBjogursqlWbK+nzJEMjbWCU=; b=a i8u48OOoWXj/05GysMn7RHrjmaDzQJzUA+NIVh5aw7TsWrXNxNhQKnn4z474aDTV 2xLezjWEgc45ll5FokmKESFJO69OAKN66xmXRMuQKMo2PZDSHHd7JZpNjfSS7L+w Rskv0EJa8j+1mkAvRfGsLjI6cgMQ9XyL5JMrqcc/UM=
Received: from dhcp118.verkstad.net (dhcp118.verkstad.net [192.36.157.118]) (Authenticated sender: vladimir@d2dx.com) by homiemail-a6.g.dreamhost.com (Postfix) with ESMTPA id 1B8F159806C; Tue, 17 Aug 2010 01:02:14 -0700 (PDT)
Mime-Version: 1.0 (Apple Message framework v1078)
Content-Type: multipart/signed; boundary="Apple-Mail-26-929738654"; protocol="application/pkcs7-signature"; micalg="sha1"
From: Vladimir Katardjiev <vladimir@d2dx.com>
X-Priority: 3 (Normal)
In-Reply-To: <d0e8fb4ae49f7a63b1436c7e45f7dc33.squirrel@sm.webmail.pair.com>
Date: Tue, 17 Aug 2010 10:02:12 +0200
Message-Id: <34697163-B25B-40B3-811D-80F29C18003D@d2dx.com>
References: <7ffabb591b2292c9b81abecfaec3cdb6.squirrel@sm.webmail.pair.com> <2a948416b1f6e4ba90a4af22e1383719.squirrel@sm.webmail.pair.com> <77A8E7C5-ED79-4BBE-AFA9-10F4A21FB66F@d2dx.com> <d0e8fb4ae49f7a63b1436c7e45f7dc33.squirrel@sm.webmail.pair.com>
To: shelby@coolpage.com
X-Mailer: Apple Mail (2.1078)
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] New port and Tunneling?
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, 17 Aug 2010 08:01:41 -0000

Just running this explanation (since I know it by heart already); I'll get to other points in due time.

On 17 aug 2010, at 08.44, Shelby Moore wrote:
>> I should also note that TCP doesn't guarantee delivery.
> 
> 
> Thanks for clarification.  What I meant is that TCP guarantees that we
> know when something wasn't delivered.  

No, it does not. You cannot prove the lack of existence of an event; you can only prove the existence of it. In other words, TCP can, in terms of the TCP stack itself, realise that a given packet has been delivered. It cannot realise that a given packet has been lost (it just assumes it is. This is why some packets are delivered twice). However, the TCP stack does not generally expose this functionality to upper layers. Namely, it's generally not possible for us as an application writer to ascertain that any given byte has been delivered. Since this means that even your garden variety TCP connection is not a stable transfer option, every application needs to assume that messages can and will be lost, and thus will have their own ACKs layered on top.
> 
>> This is exactly
>> the reason why WebSockets needs orderly close as part of the protocol
>> itself (because otherwise TCP may lose data).
> 
> I do not understand, because that is not my area of expertise (and my
> brain is tired and I am in a rush to send this and go do other things). If
> you are willing to explain, I am willing to read. Maybe most other readers
> understand what you mean.


Simply put, a client wishes to shut down. It needs to send a final piece of data to the server, and then close() the WebSocket connection. The client writes the bytes to be sent to the TCP output buffer, but then what? In the regular case, we can't ascertain when this buffer is empty. If we close the socket while the buffer is non-empty, we risk losing the data in it, depending on the implementation.

However, let's assume that the implementation will first send the bytes, wait for ACKs, then send the FIN to close the connection. Since TCP will ACK on /delivered/ and not /read/ bytes, this does not imply the remote application received them yet (it may be processing a different request). When the remote end receives the TCP FIN, it will close down the socket, and elicit EOF on it (because the socket is closed). The remote application can now not retrieve the data that was sent. 

For this reason, all HTTP servers leave TCP connections open for a certain timeout after a successful request has been answered, because otherwise the client might not get the entire page delivered. And for this reason WebSockets has an orderly close mechanism, to ensure that the data has been delivered before the connection is closed.

The reason I bring this up is because when you state that proxies break the guarantee of TCP, I state they don't. TCP never guarantees that data will be delivered. TCP guarantees the following:

Each byte read from the remote endpoint's socket will correspond to the same byte that was written in the local endpoint's socket. The bytes that arrive will arrive in the same order, and with no data corruption.

TCP also provides flow and congestion control, but these are minor in comparison.

What you likely refer to when you believe TCP guarantees delivery is the TCP retransmission mechanic. While a very good mechanic for a live stream, it does not guarantee you'll know where a transmission fails, only that it has failed. It's up to the application layer protocol to discover this failure and handle it. 

With that in mind, I hold that intermediaries can very well provide a similar level of service that plain TCP can. History has also shown that we're more likely to have intermediaries than not to, so I do not buy the argument that we're better off doing our best to tunnel/bypass/protect/disrupt them. Is it a compromise? Yes. But I believe it is a necessary compromise between those who wish to provide a new type of service and those who wish to manage their networks.

Cheers,
Vladimir