Issue metadata
Sign in to add a comment
|
Web Worker WebSocket communication blocked by main thread in Chrome
Reported by
einar.ha...@gmail.com,
Oct 11 2017
|
||||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Steps to reproduce the problem: 1. Initialize a web worker which periodically sends WebSocket messages. 2. Block the main thread (eg with an infinite while loop, or a blocking dialog). What is the expected behavior? The background thread sends and receives messages from the WebSocket, even whilst the main thread is blocked. What went wrong? Although the background thread continues to make progress whilst the main thread is blocked, the WebSocket messages aren't sent. Concretely, the WebSocket.send(...) function is executed and the following code is executed, but the messages are not sent until the main thread is unblocked (I've confirmed this by looking at the logs in my test server). Did this work before? No Does this work in other browsers? No Same problem, but in other browsers the WebSocket.send(...) function blocks when the main thread is blocked. In Chrome, the send function does not block, but messages are not actually delivered until the main thread becomes available. Chrome version: 63.0.3236.0 Channel: dev OS Version: 10 Flash Version: The problem has been reported previously (https://bugs.chromium.org/p/chromium/issues/detail?id=443374) and was marked as fixed on Aug 29 2017, but as far as I can tell the fix only applies to XMLHttpRequests, and not WebSocket communication.
,
Oct 11 2017
I don't think we need bisect because this likely was always the case. It's only very recently that we moved some resource fetching off the main thread ( issue 443374 ). cc horo@ to confirm.
,
Oct 12 2017
This is expected behaviour. Not good behaviour, but expected. Interesting to hear that we do better than other browsers. send() in Worker was made non-blocking in 2014 by yhirano@: https://bugs.chromium.org/p/chromium/issues/detail?id=397403#c4 Issue 397403 was already covering this, so I am marking this issue as a duplicate. |
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by ligim...@chromium.org
, Oct 11 2017