microsoft / vscode-jupyter-hub

Jupyter Hub Support in VS Code
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter-hub
MIT License
8 stars 6 forks source link

"Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer" on multiple actions #67

Open BCutlerSparkNZ opened 1 week ago

BCutlerSparkNZ commented 1 week ago

It looks like the latest version of this extension is having trouble handling WS messages from a remote JH server.

The exceptions appear in the Jupyter extension logs - but the issue seems to be caused by the latest version of this JupyterHub extension. Reverting to the previous version resolves the issue.

Environment data

Expected behaviour

Able to:

Actual behaviour

Actions never complete, and a number of Error logs are seen in Jupyter Extension logs.

Steps to reproduce:

  1. Create a new notebook in VS Code
  2. Select a kernel from a remote JH server using the kernel picker (succeeds)
  3. Run a code cell (in this case a simple import os) - cell never completes running, sits with a "clock" icon
  4. Hit "Restart" kernel button - info notification appears with message "Restarting Kernel : Python 3 (ipykernel)" and never closes.

Logs

Logs are from the Jupyter Extension.

16:04:34.541 [trace] Preferred Remote kernel for Untitled-1.ipynb is 83f9c60a-e0f1-42be-ba88-9ff73676e715
16:04:34.542 [debug] Using notebook.selectKernel to force remote kernel for Untitled-1.ipynb to 83f9c60a-e0f1-42be-ba88-9ff73676e715
16:04:34.545 [debug] No interpreter for Pylance for Notebook URI "Untitled-1.ipynb"
16:04:34.576 [trace] No controller, hence notebook communications cannot be initialized for editor Untitled-1.ipynb
16:04:36.562 [warn] Failed to switch remote kernel for Untitled-1.ipynb to 83f9c60a-e0f1-42be-ba88-9ff73676e715
16:04:42.090 [debug] KernelProvider switched kernel to id = ea9de0a6067a24771867b9a6e417e66141d0badf105dbe15bce49efdc57df5ba..python3./python./.-m#ipykernel_launcher
16:04:42.092 [trace] Registering commtarget jupyter.widget
16:04:42.093 [debug] Controller selection change completed
16:04:52.876 [debug] Handle Execution of Cells 0 for Untitled-1.ipynb
16:04:52.877 [debug] start the kernel, options.disableUI=false for Untitled-1.ipynb
16:04:52.877 [info] Starting Kernel (Python 3 (ipykernel)) for 'Untitled-1.ipynb' (disableUI=false)
16:04:53.166 [trace] createNewKernelSession ea9de0a6067a24771867b9a6e417e66141d0badf105dbe15bce49efdc57df5ba..python3./python./.-m#ipykernel_launcher
16:04:53.478 [info] https://jupyterhub.server.tld/user/~/: Kernel started: b66440f9-3cfc-4d96-a490-b81045f5655e
16:04:53.479 [trace] Waiting for idle on (kernel): b66440f9-3cfc-4d96-a490-b81045f5655e -> unknown
16:04:53.963 [trace] Got status busy in waitForIdleOnSession
16:04:53.965 [trace] Got status idle in waitForIdleOnSession
16:04:53.967 [trace] Finished waiting for idle on (kernel): b66440f9-3cfc-4d96-a490-b81045f5655e -> idle
16:04:53.968 [info] Started session for kernel startUsingRemoteKernelSpec:ea9de0a6067a24771867b9a6e417e66141d0badf105dbe15bce49efdc57df5ba..python3./python./.-m#ipykernel_launcher
16:04:53.969 [trace] Started running kernel initialization for Untitled-1.ipynb
16:04:53.972 [trace] Executing silently Code (idle) = try:\nimport ipywidgets as _VSCODE_ipywidgets\nprint("e976ee50-99ed-4aba-9b6b-9dcd5634d07d:IPy
16:04:54.079 [trace] Executing silently Code (completed) = try:\nimport ipywidgets as _VSCODE_ipywidgets\nprint("e976ee50-99ed-4aba-9b6b-9dcd5634d07d:IPy with 1 output(s)
16:04:54.081 [trace] Determined IPyWidgets Version as 8
16:04:54.083 [trace] Version of IPyWidgets 8 determined after 11.99s
16:04:54.084 [trace] Executing silently Code (idle) = def __VSCODE_inject_module():\ndef __VSCODE_call_function(function, callback, data=None):
16:04:54.172 [trace] Executing silently Code (completed) = def __VSCODE_inject_module():\ndef __VSCODE_call_function(function, callback, data=None): with 0 output(s)
16:04:54.172 [debug] Requesting Kernel info
16:04:54.173 [trace] Got Kernel info
16:04:54.173 [trace] End running kernel initialization, now waiting for idle
16:04:54.174 [trace] Waiting for idle on (kernel): b66440f9-3cfc-4d96-a490-b81045f5655e -> idle
16:04:54.174 [trace] Finished waiting for idle on (kernel): b66440f9-3cfc-4d96-a490-b81045f5655e -> idle
16:04:54.175 [trace] End running kernel initialization, session is idle
16:04:54.175 [debug] Updating preferred kernel for remote notebook b66440f9-3cfc-4d96-a490-b81045f5655e
16:04:54.175 [trace] Registering Kernel Completion Provider from kernel Python 3 (ipykernel) for language python
16:04:54.176 [debug] Start refreshing Kernel Picker (1725422694176)
16:04:54.176 [trace] IPyWidgetScriptSource.initialize
16:04:54.177 [info] Kernel successfully started
16:04:54.180 [trace] Cell Index:0 sent to kernel
16:04:54.184 [trace] Storing Preferred remote kernel for Untitled-1.ipynb is b66440f9-3cfc-4d96-a490-b81045f5655e
16:04:54.212 [trace] Executing silently Code (idle) = # Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License.\n# Sou
16:04:54.213 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.241 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.241 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.241 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.243 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.243 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.243 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.243 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.243 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.243 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.286 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.287 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.287 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.287 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.287 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:04:54.439 [trace] Disposing Jupyter Lab Helper
16:04:54.439 [trace] SessionManager - dispose contents manager
16:04:54.440 [trace] ShutdownSessionAndConnection - dispose session manager
16:04:54.440 [trace] Finished disposing Jupyter Lab Helper
16:04:54.440 [trace] UniversalRemoteKernelFinder: Writing 4 remote kernel connection metadata to cache
16:04:54.486 [trace] Disposing Jupyter Lab Helper
16:04:54.486 [trace] SessionManager - dispose contents manager
16:04:54.487 [trace] ShutdownSessionAndConnection - dispose session manager
16:04:54.487 [trace] Finished disposing Jupyter Lab Helper
16:04:54.488 [trace] UniversalRemoteKernelFinder: Writing 19 remote kernel connection metadata to cache
16:04:54.490 [trace] Disposing Jupyter Lab Helper
16:04:54.491 [trace] SessionManager - dispose contents manager
16:04:54.491 [trace] ShutdownSessionAndConnection - dispose session manager
16:04:54.491 [trace] Finished disposing Jupyter Lab Helper
16:04:54.492 [trace] UniversalRemoteKernelFinder: Writing 19 remote kernel connection metadata to cache
16:04:54.513 [debug] End refreshing Kernel Picker (1725422694176)
16:07:51.410 [debug] Restart kernel command handler for Untitled-1.ipynb
16:07:55.796 [debug] restart the kernel, options.disableUI=false for Untitled-1.ipynb
16:07:55.796 [info] Restart requested Untitled-1.ipynb
16:07:55.797 [debug] Cancel pending cells
16:07:55.797 [trace] Cell 0 completed in 0s (start: undefined, end: undefined)
16:07:55.798 [trace] Cell 0 executed successfully
16:07:55.815 [trace] Executing silently Code (restarting) = import os as _VSCODE_os\nimport sys as _VSCODE_sys\nimport builtins as _VSCODE_builtins\nif _VSCODE_o
16:07:55.963 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:56.003 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:56.033 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:56.473 [debug] Updating preferred kernel for remote notebook b66440f9-3cfc-4d96-a490-b81045f5655e
16:07:56.473 [info] Restarted b66440f9-3cfc-4d96-a490-b81045f5655e
16:07:56.474 [trace] Started running kernel initialization for Untitled-1.ipynb
16:07:56.474 [trace] Executing silently Code (unknown) = try:\nimport ipywidgets as _VSCODE_ipywidgets\nprint("e976ee50-99ed-4aba-9b6b-9dcd5634d07d:IPy
16:07:56.475 [trace] Storing Preferred remote kernel for Untitled-1.ipynb is b66440f9-3cfc-4d96-a490-b81045f5655e
16:07:56.907 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:56.946 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:56.947 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:56.947 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:56.947 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:56.948 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:56.948 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:56.948 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:59.520 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:59.522 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:59.523 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:59.523 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:59.527 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:59.528 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:59.590 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:59.591 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
16:07:59.591 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
torbensky commented 1 week ago

I just ran into the exact same issue today. Notebooks that were previously working weren't working today. Even a simple hello world. I could not execute a cell. When observing the logs, I also noticed the [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer error.

After a lot of troubleshooting and failing, I found that reverting the extension to version v2023.10.1003012305 solved the problem.

(looks like https://github.com/microsoft/vscode-jupyter-hub/issues/68 might be a duplicate)

KrisCien commented 1 week ago

Same here looks like regression in newest version, reverting to version v2023.10.1003012305 solves the the problem.