Re: [hybi] Clarify the role of closing handshake

Gabriel Montenegro <Gabriel.Montenegro@microsoft.com> Thu, 10 February 2011 00:21 UTC

Return-Path: <Gabriel.Montenegro@microsoft.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 1862F3A67FA for <hybi@core3.amsl.com>; Wed, 9 Feb 2011 16:21:52 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -8.298
X-Spam-Level:
X-Spam-Status: No, score=-8.298 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001, MANGLED_TOOL=2.3, RCVD_IN_DNSWL_HI=-8]
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 9B5SmPFGHkIX for <hybi@core3.amsl.com>; Wed, 9 Feb 2011 16:21:50 -0800 (PST)
Received: from smtp.microsoft.com (maila.microsoft.com [131.107.115.212]) by core3.amsl.com (Postfix) with ESMTP id 4E7333A682D for <hybi@ietf.org>; Wed, 9 Feb 2011 16:21:46 -0800 (PST)
Received: from TK5EX14MLTC102.redmond.corp.microsoft.com (157.54.79.180) by TK5-EXGWY-E801.partners.extranet.microsoft.com (10.251.56.50) with Microsoft SMTP Server (TLS) id 8.2.176.0; Wed, 9 Feb 2011 16:21:56 -0800
Received: from TK5EX14MLTW652.wingroup.windeploy.ntdev.microsoft.com (157.54.71.68) by TK5EX14MLTC102.redmond.corp.microsoft.com (157.54.79.180) with Microsoft SMTP Server (TLS) id 14.1.270.2; Wed, 9 Feb 2011 16:21:56 -0800
Received: from TK5EX14MBXW605.wingroup.windeploy.ntdev.microsoft.com ([169.254.5.102]) by TK5EX14MLTW652.wingroup.windeploy.ntdev.microsoft.com ([157.54.71.68]) with mapi; Wed, 9 Feb 2011 16:21:55 -0800
From: Gabriel Montenegro <Gabriel.Montenegro@microsoft.com>
To: Takeshi Yoshino <tyoshino@google.com>, "hybi@ietf.org" <hybi@ietf.org>
Thread-Topic: [hybi] Clarify the role of closing handshake
Thread-Index: AQHLyLZQD4/LNEvRdUK4csWEI+DaLJP53n3g
Date: Thu, 10 Feb 2011 00:21:55 +0000
Message-ID: <CA566BAEAD6B3F4E8B5C5C4F61710C1126E042FE@TK5EX14MBXW605.wingroup.windeploy.ntdev.microsoft.com>
References: <AANLkTi=wAwQHGbu_vVS5o9yNuC-M=e_hWwtU5F6UPGqm@mail.gmail.com>
In-Reply-To: <AANLkTi=wAwQHGbu_vVS5o9yNuC-M=e_hWwtU5F6UPGqm@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Content-Type: multipart/alternative; boundary="_000_CA566BAEAD6B3F4E8B5C5C4F61710C1126E042FETK5EX14MBXW605w_"
MIME-Version: 1.0
Subject: Re: [hybi] Clarify the role of closing handshake
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: Thu, 10 Feb 2011 00:21:52 -0000

+1 on Dropping feature B (data draining) and only keeping the simple semantics of feature A as you say below:

a) peer B assume that no more data is coming from peer A when B receives closing initiation from A

Either side has to be ready for the other side going away without warning (a user just yanking the page in the browser). Any value for data draining is suspect and better handled at the application. There may be value in having it as a signal to intermediaries so they can claim state earlier than they might have otherwise (they also have to have timeouts as they cannot rely on the Close message being cleanly sent), but then the simplest form is enough.

My suggestion on Close is to simplify it along these lines:


*         Using simple close semantics (whoever sends it, closes the entire session).

*         No half-close semantics as in TCP

*         Assuming that any data draining must be taken care of by the app, so no need for acking a close.

*         Assuming that the primary purpose of a Close is to inform intermediaries that the session is now terminated.

Proposed text is:

4.5.1.  Close

   The Close message contains an opcode of 0x01 and no body.

   The websocket is considered fully closed when an endpoint has either sent or received a Close message.
   Accordingly, upon sending or receiving a Close message, no more data or control messages can be sent on  the websocket.

Comments?

Gabriel



From: hybi-bounces@ietf.org [mailto:hybi-bounces@ietf.org] On Behalf Of Takeshi Yoshino
Sent: Wednesday, February 09, 2011 16:05
To: hybi@ietf.org
Subject: [hybi] Clarify the role of closing handshake

Long time has passed since there was active discussion on closing handshake design. Closing handshake detail has been gradually changed in -01 and -05 adopting suggestions from tickets and posts on the list, and now there is some inconsistency between sections. I think now it's good time to discuss again what closing handshake should realize, how it should be done, and what _cleanly_ means.

== What closing handshake should realize ==
Now it seems closing handshake in -05 is designed to realize two things.
a) peer B assume that no more data is coming from peer A when B receives closing initiation from A
b) peer A assume that all the data sent out has been successfully received by peer B when A receives closing acknowledgement from B

Section 1.4 in -05 states only a), but I thought that b) is also closing handshake's objective. e.g. this old post http://www.ietf.org/mail-archive/web/hybi/current/msg01526.html by Hixie says so.

How many people on this list are supportive for having feature-b) realized by closing handshake? When I was talking with people offlist, some were doubtful about the usefulness of this feature. It think most apps would build their own shutdown protocol and doesn't rely on WebSocket closing handshake.

== How it should be done for each option ==
1) If we need only a), a) can be simply realized by closing frame without body.

2) If we need both a) and b), we have to distinguish closing initiation and acknowledgement since it's possible that both sides initiate closing at the same time.

Some sentences ("A received close message is deemed to be ..." in Section 4.5.1) were added to -01 to ask each peer to check the body of closing frame to distinguish if it's acknowledgement or not". This was incomplete as Gabriel pointed out in http://trac.tools.ietf.org/wg/hybi/trac/ticket/34, but it's now almost addressed in -05. I think we need to make one more tiny fix on 4.5.1, but then, I think it's perfect.

== What does _cleanly_ means? ==
By the word _cleanly_ all the information about closing handshake is passed to the WebSocket API.

If we take 1), _cleanly_ means the user agent has received all data from the server.

If we take 2),... in -05, _cleanly_ has different meaning depending on whether client initiated close or server initiated close. If client initiated close, _cleanly_ means the user agent has received all data from the server and all the data sent to the server has been received by the server. If server initiated close, _cleanly_ only means the user agent has received all data from the server. Since we're going to assure b), the user agent should initiate closure before sending back acknowledgement (we need some change in 4.5.1). Then, _cleanly_ means the same for both cases.

====

Let's make decision here to clean-up closing handshake stuff in the spec.

1) keep feature-b)
- Change Section 1.4 to mention that closing handshake is designed to realize feature-b)
- Fix 4.5.1 so that a peer wait until receiving acknowledgement if it has initiated closing handshake
2) drop feature-b)
- Drop body comparison procedure added in -01
- Avoid using a word "acknowledgement". It's confusing IMO.