Re: [hybi] Clarify the role of closing handshake

Yutaka_Takeda@PlayStation.Sony.Com Fri, 11 February 2011 20:52 UTC

Return-Path: <Yutaka_Takeda@PlayStation.Sony.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 4ECA23A6878; Fri, 11 Feb 2011 12:52:10 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.114
X-Spam-Level:
X-Spam-Status: No, score=-6.114 tagged_above=-999 required=5 tests=[AWL=0.150, BAYES_00=-2.599, HTML_MESSAGE=0.001, IP_NOT_FRIENDLY=0.334, RCVD_IN_DNSWL_MED=-4]
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 Uiu+IrGl116r; Fri, 11 Feb 2011 12:52:08 -0800 (PST)
Received: from paris.playstation.sony.com (nat.playstation.sony.com [69.36.131.254]) by core3.amsl.com (Postfix) with ESMTP id 905783A67B3; Fri, 11 Feb 2011 12:52:08 -0800 (PST)
Received: from constantine.playstation.sony.com ([162.49.67.15]) by paris.playstation.sony.com (Lotus Domino Release 8.5.1FP5) with ESMTP id 2011021112521777-468464 ; Fri, 11 Feb 2011 12:52:17 -0800
In-Reply-To: <4D5572C5.2000703@ericsson.com>
To: Salvatore Loreto <salvatore.loreto@ericsson.com>
MIME-Version: 1.0
X-KeepSent: AAD26076:80417033-88257834:006C2055; type=4; flags=0; name=$KeepSent
X-Mailer: Lotus Notes Release 7.0.2 September 26, 2006
Message-ID: <OFAAD26076.80417033-ON88257834.006C2055-88257834.0072D42E@playstation.sony.com>
From: Yutaka_Takeda@PlayStation.Sony.Com
Date: Fri, 11 Feb 2011 12:54:13 -0800
X-MIMETrack: Serialize by Router on SCEA919ML04/SCEA(Release 8.5.1FP3|May 23, 2010) at 02/11/2011 12:52:17 PM, Serialize complete at 02/11/2011 12:52:17 PM, Itemize by SMTP Server on SCEA919ML02/SCEA(Release 8.5.1FP5|September 29, 2010) at 02/11/2011 12:52:17 PM, Serialize by Router on SCEA919ML02/SCEA(Release 8.5.1FP5|September 29, 2010) at 02/11/2011 12:52:24 PM, Serialize complete at 02/11/2011 12:52:24 PM
Content-Type: multipart/alternative; boundary="=_alternative 0072D42C88257834_="
Cc: hybi-bounces@ietf.org, hybi@ietf.org
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: Fri, 11 Feb 2011 20:52:10 -0000

Hi,

> - Peer B assumes that no more data is coming from peer A when B 
> receives closing 
> initiation from A.

I agree - much simpler

As a side note, the other option (b) requires one extra state to wait 
for an acknowledgement upon sending Close frame. I was wondering who 
would be responsible for managing lifetime of the extra state, and 
yet it would be complicated.

Here is my comments to Takeshi's proposal in: 
http://www.ietf.org/mail-archive/web/hybi/current/msg06285.html 

> 4.5.1.  Close
> 
> The Close message contains an opcode of 0x01.
> 
> The Close message contains a body that is a single byte in length. 
>  This byte carrys the reason for the close.  For normal close, the 
> body MUST be a 0x00. For abnormal close, the body MUST be a 0x01.
>  
> The websocket is considered fully closed when an endpoint has either
> sent or received a Close message, or when the underlying channel is 
closed.
> 
> The application MUST NOT send any more data messages after sent or 
> received a Close message.

Looks good.

> 
> 7.1.1.  Client-initiated closure
> 
> <I'm not sure how much it's useful to have client send 
> normal/abnormal. Server cannot retry by itself so, it's not the case
> Greg explained. But maybe we can just add it as well as server.>

I do not see the usefulness of the normal/abnormal at app level either.
But it may be helpful for counting such events to monitor for admin 
purposes or for trouble shooting.

> 
> 7.1.2.  Server-initiated closure
> 
> <No change on *abort WebSocket connection* during opening handshake>
> 
> Certain algorithms require or recommend that the server *abort2 
> the WebSocket connection* after WebSocket connection is established.
>  To do so, the server must send a Close message with a single byte 
> body 0x01 meaning abnormal closure and close the WebSocket connection.
> 
> <We need some verb to replace abort2>

I am ok this to be as is (besides 'abort2')

> 7.2.  Normal closure of connections
> 
> To *close the WebSocket connection*, the user agent MUST send 
> a Close control frame with a single byte body 0x00 meaning normal 
> closure, as described in Section 4.5.1.  Once an endpoint has sent 
> or received an Close control frame, that endpoint must close the TCP

As long as we cannot rule out the case where there may be incoming
data in the TCP buffer at the time of Close frame send, the endpoint
should not close socket right away, otherwise TCP-RST is sent to the 
peer, and the Close frame that has just sent may not reach the 
remote app. So, WebSocket layer needs to take care of this cleanup
sequence:

[App]          [WS-layer]     [TCP socket]
  |    close()     |               |<--- data
  +--------------->|  send(Close)  |<--- data
  |<- - - - - - - -|-------------->|----> FIN
  |                |  * recv()     |<--- data
  |                |till EOS(0 rtn)|
  |                |-------------->|
  |                |    close(|    |
  |                |-------------->x
  |                |

This is an implementation issue, but worth mentioning.

> ...  If the connection was closed after the client sent or received 
> normal close frame, then it's called _normal close_. If the 
> connection was closed after the client send or received abnormal 
> close frame, then it's called _abnormal close_. Otherwise, it's 
> called _underlying connection terminated_.
> 
> The user agent can distinguish protocol failure notified by abnormal
> close frame from disconnection caused by network or intermediary to 
> allow the application to determine if it should retry connection or not.

Sounds good.


Best.
--
Yutaka Takeda - US R&D Sony Computer Entertainment, Inc.
Office: 650 655 7484   Fax: 650 655 8060


hybi-bounces@ietf.org wrote on 02/11/2011 09:32:53 AM:

> The current -05 as is seems good to me. Now I think it would be good
> to have 1-byte body 
> 0x43 and 0x53, if it is important to know whether all data sent 
> successfully reached the peer. 
> I just do not know how import that is from application's perspective. 
> 
> Hi Yutaka
> 
> People seems agree that this can be handled at application level,
> (the fact that you also say that it is difficult to know how important 
that is
> from an application's prospective seem that you agree on that, but then
> the rest of your message confuse me, can you clarify what you would 
like?)
> 
> People seems agree, withing this thread, that at protocol level it 
> is enough to go for the simplest scenario:
> 
> - Peer B assumes that no more data is coming from peer A when B 
> receives closing 
> initiation from A.
> 
> please read the text suggested from Takeshi in 
> http://www.ietf.org/mail-archive/web/hybi/current/msg06285.html
> and check if it works for you
> 
> cheers
> /Sal

> -- 
> Salvatore Loreto
> www.sloreto.com
> 
> _______________________________________________
> hybi mailing list
> hybi@ietf.org
> https://www.ietf.org/mailman/listinfo/hybi