[Webkit-unassigned] [Bug 235707] WebSocket.send() overflows the buffer but bufferedAmount is zero

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 28 09:14:19 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=235707

--- Comment #1 from Roberto D'Auria <roberto at measurementlab.net> ---
Adding some more information I've gathered about this:

I've also tested the most recent WebKit release on a Linux system (using Epiphany Technology Preview as recommended by the repository's README) - version 42.alpha-23-ga73a12344+.

On Linux, the JavaScript code above fails in a different way:

- bufferedAmount never exceeds the size of a single message (8388608 bytes, or 8KB). It seems strange since this should depend on how fast data is written to the network. With the same hardware/Internet connection on a different browser, I get different numbers every time bufferedAmount is printed on the console during the measurement.

- send() does never fail, but the amount of data "sent" is exceedingly high - way more than my link rate, which is 100Mb/s.

- the "Network" tab reports 1.21 GBytes sent over 9.5 seconds for this WebSocket connection. This matches what's detected by the javascript code (i.e. the "total" variable at the end of the measurement).

- the Mb/s rate with the above figures would be ~975 Mb/s.

- closing the Developer Tools during the measurement brings the speed up to > 4Gb/s.

I suspect this is either measuring how fast data can be written to memory, or just how fast the messages are processed and discarded after a send(), rather than the speed at which data is actually sent over the network.

The behavior of WebKit's WebSocket on Linux is quite different than on MacOS/iOS, based on what I'm observing. While on MacOS/iOS the issue requires a specific combination of network speed and device speed (indicatively, an upload over 100Mb/s on fast hardware) to be triggered and causes send() to fail with an error, on Linux systems the above happens every time so it can perhaps be helpful for debugging. I've also tested other WebKit-based browsers in the past (Midori and a previous release of Epiphany), getting the same results.

I've added a debug console.log() just before the bufferedAmount < desiredBuffer check and the result is visible at https://mlab-sandbox.web.app/ - just start the test and look at the JS console when it gets to the upload phase.

P.S. Please let me know if these should be treated as different bugs and I should open a separate report. It seems to me that there might be a common cause explaining both behaviors on MacOS and Linux, but I'm not familiar enough with WebKit's source code to tell.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220128/c9a0622e/attachment.htm>


More information about the webkit-unassigned mailing list