You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.
There is a race condition bug in the way we setup socket.io when we are replacing the native WebSocket implementation (which is necessary when connecting from Cloud Shell).
The issue is that our websocket.js code, which replaces the native window.WebSocket with our shim, runs after the main.min.js code, which creates the Kernel object.
The Kernel code does not directly call window.WebSocket. Instead, it copies the value of window.WebSocket at the time it was created into a field of the object, and then calls the value of that field.
This means that if we replace the window.WebSocket value before the Kernel object gets created, then our shim works as expected. However, if that replacement does not happen until the Kernel object is created, then the shim will not work.
We have two options to fix this:
Ensure the websocket.js code runs before the main.min.js code
or
Make the websocket.js code modify the field in the Kernel object.
I'm not sure if the second option is even possible, so I think the first is by far the best choice.
The text was updated successfully, but these errors were encountered:
The way this bug will manifest is a pop-up error message saying Connection failed and A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration. when opening up the Datalab UI using the WebPreview feature of Cloud Shell.
If this occurs, it should be a rare occurrence, and refreshing the page will likely fix it.
There is a race condition bug in the way we setup socket.io when we are replacing the native WebSocket implementation (which is necessary when connecting from Cloud Shell).
The issue is that our websocket.js code, which replaces the native
window.WebSocket
with our shim, runs after the main.min.js code, which creates theKernel
object.The
Kernel
code does not directly callwindow.WebSocket
. Instead, it copies the value ofwindow.WebSocket
at the time it was created into a field of the object, and then calls the value of that field.This means that if we replace the
window.WebSocket
value before theKernel
object gets created, then our shim works as expected. However, if that replacement does not happen until theKernel
object is created, then the shim will not work.We have two options to fix this:
websocket.js
code runs before themain.min.js
codeor
websocket.js
code modify the field in theKernel
object.I'm not sure if the second option is even possible, so I think the first is by far the best choice.
The text was updated successfully, but these errors were encountered: