Bug 204237

Summary: REGRESSION (Safari 13): Websocket cannot send large frames
Product: WebKit Reporter: berkus
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Major CC: achristensen, ap, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 13   
Hardware: All   
OS: macOS 10.15   
See Also: https://bugs.webkit.org/show_bug.cgi?id=202401

Description berkus 2019-11-15 11:18:05 PST
Possibly in relation with https://bugs.webkit.org/show_bug.cgi?id=170463 but posting a new bug.

Safari 13 both on macOS Catalina and iOS 13.2 fails to send large websocket frames.

In our testing, sending frames under 1k to a Twilio-specific connection works fine, but after sending a few large frames (about 32k each) the connection fails with

WebSocket connection to 'wss://tsock.us1.twilio.com/v3/wsconnect' failed: Failed to compress frame
WebSocket connection to 'wss://tsock.us1.twilio.com/v3/wsconnect' failed: Failed to send WebSocket frame.

This is a REGRESSION because the same sequence works well in Safari 12 with all the other configuration remaining the same.

I don't have a minimal example in itself, since we're using Twilio Chat quickstart to test. Just sending frames through websocket in one direction does not seem to trigger that error.

However there's a copy of the quickstart repository that contains all necessary information to start testing.

1. Grab the repository from here: https://github.com/berkus/twilio-chat-quickstart-safari13-repro/tree/safari13-repro

2. In public/chat/index.js find the text INSERT_URL_HERE and replace it with the token generator url which has already been preconfigured for you: https://aquamarine-cichlid-8646.twil.io/token?key=_aapl_repro98767542432

3. Run `npm install` and start the server using `node run start`

4. Navigate Safari to localhost:3000/chat

5. It will try to fetch and paginate approximately 600 channels and at some point you will see a NOT_ACCEPTABLE_MESSAGE response from our websocket server. At the same point there will be "Failed to compress frame" message in the console log.

Please note that NOT_ACCEPTABLE_MESSAGE is the response of our server due to break of protocol between server and client (client attempts a reconnection) - and that happens because of the failure of Safari to compress and send a frame. This is a REGRESSION in Safari 13 and it works properly in Safari 12.

We will be happy to assist with debugging this issue further.
Comment 1 Radar WebKit Bug Importer 2019-11-15 11:23:21 PST
<rdar://problem/57234281>
Comment 2 Alexey Proskuryakov 2019-11-15 11:25:48 PST
Could be same as bug 202401, but needs further analysis to confirm.
Comment 3 berkus 2019-11-15 11:31:44 PST
Looks very similar indeed, I will check if the "x-webkit-deflate-frame extension" is enabled for us.

Can it be force-disabled from the server-side somehow?
Comment 4 berkus 2019-11-20 09:41:45 PST
We have force-disabled support for "x-webkit-deflate-frame" extension on the server side. This seems to work around the problem for the time being.

I hope to see actual working permessage-deflate support in WebKit at some point in time.
Comment 5 Alexey Proskuryakov 2019-11-22 09:32:22 PST
Based on this, marking as a duplicate of bug 202401.

*** This bug has been marked as a duplicate of bug 202401 ***