Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [websocket-dev] Connection closure behaviour
  • From: Mark Thomas <markt@xxxxxxxxxx>
  • Date: Fri, 10 Jul 2020 21:06:07 +0100
  • Autocrypt: addr=markt@xxxxxxxxxx; prefer-encrypt=mutual; keydata= xsFNBEq0DukBEAD4jovHOPJDxoD+JnO1Go2kiwpgRULasGlrVKuSUdP6wzcaqWmXpqtOJKKw W2MQFQLmg7nQ9RjJwy3QCbKNDJQA/bwbQT1F7WzTCz2S6vxC4zxKck4t6RZBq2dJsYKF0CEh 6ZfY4dmKvhq+3istSoFRdHYoOPGWZpuRDqfZPdGm/m335/6KGH59oysn1NE7a2a+kZzjBSEg v23+l4Z1Rg7+fpz1JcdHSdC2Z+ZRxML25eVatRVz4yvDOZItqDURP24zWOodxgboldV6Y88C 3v/7KRR+1vklzkuA2FqF8Q4r/2f0su7MUVviQcy29y/RlLSDTTYoVlCZ1ni14qFU7Hpw43KJ tgXmcUwq31T1+SlXdYjNJ1aFkUi8BjCHDcSgE/IReKUanjHzm4XSymKDTeqqzidi4k6PDD4j yHb8k8vxi6qT6Udnlcfo5NBkkUT1TauhEy8ktHhbl9k60BvvMBP9l6cURiJg1WS77egI4P/8 2oPbzzFiGFqXyJKULVgxtdQ3JikCpodp3f1fh6PlYZwkW4xCJLJucJ5MiQp07HAkMVW5w+k8 Xvuk4i5quh3N+2kzKHOOiQCDmN0sz0XjOE+7XBvM1lvz3+UarLfgSVmW8aheLd7eaIl5ItBk 8844ZJ60LrQ+JiIqvqJemxyIM6epoZvY5a3ZshZpcLilC5hW8QARAQABzSJNYXJrIEUgRCBU aG9tYXMgPG1hcmt0QGFwYWNoZS5vcmc+wsF3BBMBCgAhBQJKtA7pAhsDBQsJCAcDBRUKCQgL BRYCAwEAAh4BAheAAAoJEBDAHFovYFnn2YgQAKN6FLG/I1Ij3PUlC/XNlhasQxPeE3w2Ovtt weOQPYkblJ9nHtGH5pNqG2/q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GLiwrcN4ukKNyFntFG5jPaFnJdx9rHfyJNeF9cgv9JlZeFxJ6WqIAhl KOuH3K8/py0SPE6ZOFfRo0YUxvh25K/siOcPLm613aOxyY7YfQ8ME2vgn7I0mAtg9am+YFDa bGqj839odwZdzZv2T2mUHnybFTJFBuMWGWKYstYDS6eZEmhupbPvUKkDug/mO+gdo+pSKF9Y S6DM5RtCdTNJq4NZY50ypBb5RSj+INHPocIp2V/DDTbzySsu6wARAQABwsFfBBgBCgAJBQJK tA7pAhsMAAoJEBDAHFovYFnnLe0P/i34oK5cE2LlqUEITEcTO94x1EX0UmtKokRfQ3AYWK8X eFD8cmSty72hMkL+1c0V//4Qc53SUyLIWXk8FKWF7hdL3zyuBqlRb55721CYC35GA/jR90p0 k1vr701gaat2cNTOVC0/6H9cE5yYXT+zMr9TSiKCDwONhhSbmAJZc6X0fgsmCD7I5xUI5Vri hN/Wx0CZBtrXGUyE4hgFaYSGptZmkY5Ln1e+nI185Bda7bpLwcAIGrI9nYtVXgf71ybGKdPP tFfXIoPXuctn99M7NnWBhNuGDms2YWkOC7eeWBTxKkZDWR3vRmRy52B6GxR7USk/KXs7yqGP kfT/c4CZFfOurZUXXuC3PvOme0DQmqwExtJormoG4Fy6suEFPrfhYMigTy7kSbVTCOBMjQLH +U/FFNshvg9+M/ZvaKT+0lpRvBSuG5ngsC0bO0xWsXhb6qfH2h53g4VcwFvCBL5IfqgAeUbC nGGHNcGWpmwdeb7D7ahrNZSHEUUYR7lTbjkYS01/QDOcEwNZOqDRIJUQOOUq35721VeROkdh ZmMZtFlsQeQJsWoqGrQo/kEYicVlMVOgjmOOzOa5fRb/IqlGlBn4a4me3hWthLLtMy+OOEim 6ENjntVTBQiTP/YqrxWDbCkaD7b2e9wY5N3JlRxMIQHfcHaND3PRdQSn7oHYXmJl
  • Delivered-to: websocket-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/websocket-dev>
  • List-help: <mailto:websocket-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/websocket-dev>, <mailto:websocket-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/websocket-dev>, <mailto:websocket-dev-request@eclipse.org?subject=unsubscribe>
  • User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 10/07/2020 19:15, Joakim Erdfelt wrote:
> inline ...
> 
> On Fri, Jul 10, 2020 at 12:04 PM Mark Thomas <markt@xxxxxxxxxx
> <mailto:markt@xxxxxxxxxx>> wrote:
> 
>     On 10/07/2020 17:06, Joakim Erdfelt wrote:
>     > On Fri, Jul 10, 2020 at 10:38 AM Mark Thomas <markt@xxxxxxxxxx
>     <mailto:markt@xxxxxxxxxx>
>     > <mailto:markt@xxxxxxxxxx <mailto:markt@xxxxxxxxxx>>> wrote:
> 
>     <snip/>
> 
>     >     Give the following from RFC 6455:
>     >
>     >     - 6.1   The session must be OPEN to send a message
>     >     - 7.1.3 Upon either sending or receiving a Close control
>     frame, it is
>     >             said that The WebSocket Closing Handshake is Started
>     and that
>     >             the WebSocket connection is in the CLOSING state.
>     >
>     >     I do not believe it is legal for an endpoint that has received
>     (and
>     >     processed) a CLOSE from to attempt to send a DATA frame.
>     >
>     >
>     > If you _receive_ a CLOSE frame that starts the close handshake,
>     you can
>     > still send more frames and even start more messages until your side
>     > sends it's CLOSE frame.
>     >
>     > This is the half-open scenario.
> 
>     But that is not what RFC 6455 says. 7.1.3 specifically states sending or
>     *receiving* a close control frame moves the WebSocket connection state
>     to CLOSING and 6.1 requires the connection state to be OPEN in order to
>     send a message.
> 
>     The phrase "half-open" does not appear anywhere I could find in RFC
>     6455.
> 
>     What am I missing in RFC 6455 that allows / supports the concept of a
>     half-closed connection?
> 
> 
> The moving from OPEN to CLOSING is a protocol behavior that your
> implementation should do when it's appropriate.
> 
> But your API and Implementation can choose when to do that.
> 
> Yeah, this is all interpretation.
> The [hybi] list has a long history of discussing this, even from the
> earliest drafts in 2009.

Hmm.

It comes down how you read "Upon ... receiving a Close control frame".

It is certainly implementable if you read that as "Receive Close frame,
call @OnClose, send close frame" and allow data frames up to the point
where the close frame is sent. But that does seem to be stretching the
definition rather.

> Jetty moves from OPEN to CLOSING after @OnOpen is called and returns.
> And moves from CLOSING to CLOSED once the closing handshake is complete.
> When not in OPEN state, attempts to write fail.

What is the sequence when Jetty receives a close message?

Tomcat is currently:
- prevent further DATA frames
- send the close message
- call @OnClose

I'm guessing Jetty is different.

I'm not at all adverse to relaxing Tomcat's implementation (assuming the
other committers agree) as it should be a non-breaking change.

What I really want to do is get a clear definition of what this group
thinks should happen, update the WebSocket spec to define the expected
behaviour more clearer and then update the TCK to test for it. Which may
well need to wait until 2.1.

> The WebSocket Proxy scenario shows this to be the most flexible choice
> and still within the confines of protocol spec.
> 
> I believe there's tests for this in the autobahn websocket testsuite.
> (but i could be remembering incorrectly).

>From memory the Autobahn tests for servers relies on the server echoing
back DATA messages so I don't think it can test a lot of the edge cases
here.

I know Tomcat passes the Autobahn tests which also makes me think a lot
of this won't be tested else I'd expect Tomcat to fail some tests based
on this conversation.

Mark


Back to the top