Re: [hybi] With deflate-stream, Close frame doesn't work as an end of data marker

Yutaka_Takeda@PlayStation.Sony.Com Fri, 18 February 2011 00:33 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 BD00A3A6DDE; Thu, 17 Feb 2011 16:33:27 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -5.95
X-Spam-Level:
X-Spam-Status: No, score=-5.95 tagged_above=-999 required=5 tests=[AWL=0.314, 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 V4MFioKT94qZ; Thu, 17 Feb 2011 16:33:26 -0800 (PST)
Received: from paris.playstation.sony.com (nat.playstation.sony.com [69.36.131.254]) by core3.amsl.com (Postfix) with ESMTP id CBB183A6C34; Thu, 17 Feb 2011 16:33:23 -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 2011021716334884-676944 ; Thu, 17 Feb 2011 16:33:48 -0800
In-Reply-To: <AANLkTimyGWacfoVFon1TsQzqmsEcKy9tNsmKhCnJhgWM@mail.gmail.com>
To: Takeshi Yoshino <tyoshino@google.com>
MIME-Version: 1.0
X-KeepSent: C19D8FEF:225C2E75-8825783A:00827B4C; type=4; flags=0; name=$KeepSent
X-Mailer: Lotus Notes Release 7.0.2 September 26, 2006
Message-ID: <OFC19D8FEF.225C2E75-ON8825783A.00827B4C-8825783B.00031959@playstation.sony.com>
From: Yutaka_Takeda@PlayStation.Sony.Com
Date: Thu, 17 Feb 2011 16:33:50 -0800
X-MIMETrack: Serialize by Router on SCEA919ML04/SCEA(Release 8.5.1FP3|May 23, 2010) at 02/17/2011 04:33:48 PM, Serialize complete at 02/17/2011 04:33:48 PM, Itemize by SMTP Server on SCEA919ML02/SCEA(Release 8.5.1FP5|September 29, 2010) at 02/17/2011 04:33:48 PM, Serialize by Router on SCEA919ML02/SCEA(Release 8.5.1FP5|September 29, 2010) at 02/17/2011 04:33:59 PM, Serialize complete at 02/17/2011 04:33:59 PM
Content-Type: multipart/alternative; boundary="=_alternative 000319578825783B_="
Cc: hybi-bounces@ietf.org, hybi@ietf.org
Subject: Re: [hybi] With deflate-stream, Close frame doesn't work as an end of data marker
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, 18 Feb 2011 00:33:28 -0000

Hi Takeshi,

Good point. There is indeed a legitmate case where trailing bytes is 
present after 
Close frame.

It is important to note that after endpoint sent and received Close frame, 
it is considered 
that WebSocket layer close handshake has been complete ('wasClear' gets 
set to 1, 
etc.).

What Takeshi pointed out is a good motivation for WS-layer to perform 
graceful 
shutdown at TCP layer as well. After Close frame has been exchanged 
successfully, 
the endpoint must start shutting down the local TCP connection with 
shutdown(SHUT_WR), and discard the trailing bytes, if any received, and 
then finally 
close the socket on receipt of EoS.

This works for any trailing bytes that could be caused by artifact of 
another deflate 
algorithm that may be introduced in the future, or just by a bug.


- Yutaka


hybi-bounces@ietf.org wrote on 02/16/2011 06:20:18 PM:

> It's still under discussion if it's really necessary (see "Clarify 
> the role of closing handshake" thread), but RST suppression was one 
> of the original objectives of Close frame. Close frame assures no 
> more data is coming on the underlying channel to allow the endpoint 
> to close(2) safely.
> 
> deflate-stream extension in -05 applies deflate on whole octets of a
> frame including the header. If we simply use zlib's flush, we can 
> spoil this function of Close frame. There can be some data remain 
> not processed/recv-ed even after getting a Close frame uncompressed.
> 
> e.g.
> (if Z_SYNC_FLUSH is used) possibly a few octets containing EoB 
> symbol, 3-bit header, padding, and then BTYPE=00 block "00 00 ff ff".
> (if Z_FINISH is used) possibly one octet containing EoB symbol.
> 
> Endpoints need to drain these octets to prevent RST. This should be 
noted.
> 
> Takeshi_______________________________________________
> hybi mailing list
> hybi@ietf.org
> https://www.ietf.org/mailman/listinfo/hybi