Commit e0a3b8ab authored by Adam Rice's avatar Adam Rice Committed by Chromium LUCI CQ

WebSocketStream: Make backpressure-receive.any.js work again

The web test
external/wpt/websockets/stream/tentative/backpressure-receive.any.js
started failing on Windows 10 with the switch to Python 3. It appears
some additional buffering is happening in the OS. As a workaround,
split the large message that is supposed to be delayed by backpressure
into 16 parts.

BUG=1155106

Change-Id: Ifa2b04e4857f3c537721735cec187f610c053d99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2613853
Commit-Queue: Domenic Denicola <domenic@chromium.org>
Auto-Submit: Adam Rice <ricea@chromium.org>
Reviewed-by: default avatarDomenic Denicola <domenic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841571}
parent 3cc1c6fe
......@@ -51,11 +51,6 @@ crbug.com/1048761 external/wpt/infrastructure/server/wpt-server-wpt-flags.sub.ht
# WPT Test harness doesn't deal with finding an about:blank ref test
crbug.com/1066130 external/wpt/infrastructure/assumptions/blank.html [ Failure ]
# When running under Python 3 on Windows, this test fails to activate backpressure.
crbug.com/1155106 external/wpt/websockets/stream/tentative/backpressure-receive.any.html [ Failure ]
crbug.com/1155106 external/wpt/websockets/stream/tentative/backpressure-receive.any.worker.html [ Failure ]
crbug.com/1155106 external/wpt/websockets/stream/tentative/backpressure-receive.any.sharedworker.html [ Failure ]
# Favicon is not supported by run_web_tests.
external/wpt/fetch/metadata/favicon.https.sub.html [ Skip ]
......
......@@ -9,7 +9,12 @@ import time
# this number too large will result in false positives, when it takes more than
# 2 seconds to transmit the message anyway. This number was arrived at by
# trial-and-error.
MESSAGE_SIZE = 16 * 1024 * 1024
MESSAGE_SIZE = 1024 * 1024
# With Windows 10 and Python 3, the OS will buffer an entire message in memory
# and return from send() immediately, even if it is very large. To work around
# this problem, send multiple messages.
MESSAGE_COUNT = 16
def web_socket_do_extra_handshake(request):
......@@ -26,8 +31,10 @@ def web_socket_transfer_data(request):
# 3 is complete. time.time() can go backwards.
start_time = time.time()
# The large message that will be blocked by backpressure.
# The large messages that will be blocked by backpressure.
for i in range(MESSAGE_COUNT):
request.ws_stream.send_message(b' ' * MESSAGE_SIZE, binary=True)
# Report the time taken to send the large message.
request.ws_stream.send_message(six.text_type(time.time() - start_time), binary=False)
request.ws_stream.send_message(six.text_type(time.time() - start_time),
binary=False)
......@@ -5,6 +5,7 @@
// Allow for this much timer jitter.
const JITTER_ALLOWANCE_MS = 200;
const LARGE_MESSAGE_COUNT = 16;
// This test works by using a server WebSocket handler which sends a large
// message, and then sends a second message with the time it measured the first
......@@ -22,8 +23,10 @@ promise_test(async t => {
// Skip the empty message used to fill the readable queue.
await reader.read();
// Skip the large message.
// Skip the large messages.
for (let i = 0; i < LARGE_MESSAGE_COUNT; ++i) {
await reader.read();
}
// Read the time it took.
const { value, done } = await reader.read();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment