microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.28k stars 287 forks source link

Extension host terminated uexpectedly when using ipywidgets.Fileupload #4525

Closed beralves closed 3 years ago

beralves commented 3 years ago

Environment data

Expected behaviour

ipywidgets.Fileupload should work on vscode while running the notebook. Fileupload works if I launch "jupyter notebook" in the command and run my notebook there. It would be helpful to run it inside vscode, to avoid context switching and use debug features.

Actual behaviour

ipywidgets.Fileupload crashes extension host on vscode while running the notebook. I get the message "Extension host terminated uexpectedly."

Steps to reproduce:

  1. Create a notebook and include an ipywidgets.Fileupload. Run the cell, it displays fine. Click "upload", select the file you would like to upload. When you click "OK" to close the file browser dialog you get the error message.

Logs

Output for Jupyter in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Jupyter)

``` XXX ```

rchiodo commented 3 years ago

Thanks for the bug. We haven't tried using FileUpload before, but we'll see if we can repro with it.

rchiodo commented 3 years ago

Yep crashes the host for me too. Just do this:

widgets.FileUpload(accept='', multiple = False)

Then click on the Upload button and pick a text file. Extension host will die

rchiodo commented 3 years ago

Looks to me like a message buffer being to big. Callstack for crash is here:

postToSocket (d:\Source\vscode-jupyter\src\client\datascience\raw-kernel\rawSocket.ts:230)
(anonymous function) (d:\Source\vscode-jupyter\src\client\datascience\raw-kernel\rawSocket.ts:222)
VM_Unknown (undefined:97)
[ Promise.then ]
sendMessage (d:\Source\vscode-jupyter\src\client\datascience\raw-kernel\rawSocket.ts:221)
sendToRealKernel (d:\Source\vscode-jupyter\src\client\datascience\raw-kernel\rawSocket.ts:104)
sendPendingMessages (d:\Source\vscode-jupyter\src\client\datascience\ipywidgets\ipyWidgetMessageDispatcher.ts:354)
sendRawPayloadToKernelSocket (d:\Source\vscode-jupyter\src\client\datascience\ipywidgets\ipyWidgetMessageDispatcher.ts:142)
receiveMessage (d:\Source\vscode-jupyter\src\client\datascience\ipywidgets\ipyWidgetMessageDispatcher.ts:109)
receiveMessage (d:\Source\vscode-jupyter\src\client\datascience\ipywidgets\ipyWidgetMessageDispatcherFactory.ts:42)
onMessage (d:\Source\vscode-jupyter\src\client\datascience\ipywidgets\commonMessageCoordinator.ts:106)
(anonymous function) (d:\Source\vscode-jupyter\src\client\datascience\ipywidgets\notebookIPyWidgetCoordinator.ts:88)
fire (event.ts:623)
onDidReceiveMessage (extHostNotebook.ts:44)
$onDidReceiveMessage (extHostNotebook.ts:612)
_doInvokeHandler (rpcProtocol.ts:409)
_invokeHandler (rpcProtocol.ts:394)
_receiveRequest (rpcProtocol.ts:310)
_receiveOneMessage (rpcProtocol.ts:246)
(anonymous function) (rpcProtocol.ts:105)
rchiodo commented 3 years ago

The ZMQ library is crashing trying to send the data to kernel.

beralves commented 3 years ago

Hi, any plans for this issue? I'm happy to test if needed.

rchiodo commented 3 years ago

There are no plans to fix this at the moment. We generally wait for more feedback before prioritizing.

A workaround might be to start your own jupyter server and set it as the 'remote' URI to connect to. That should use a different communication mechanism to send the data to the kernel then. I haven't tried it though.