microsoft / vscode-jupyter

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

FileUpload widget does not work with VS Code Notebooks? Renders UI to upload, but cannot read output (runs infinitely with no error or timeout) #13469

Closed epicwhale closed 11 months ago

epicwhale commented 1 year ago

Environment data

Expected behaviour

Upload a file --> be able to read it's value in next cell

Actual behaviour

The cell where I try to read the file value runs infinitely.. never returns

Steps to reproduce:

  1. Create two cells
    import ipywidgets as widgets
    uploader = widgets.FileUpload()
    uploader
uploader.value[0]
  1. Attach image to first cell and run second
image

Logs

Nothing specific to the issue being outputted.. like I said earlier, the second cell just keeps running infinitely

``` 11:39:17.525 [info] Restart requested Untitled-1.ipynb 11:39:17.528 [info] Process Execution: ~/code/fastai_course/.conda/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)" 11:39:17.549 [info] Process Execution: ~/code/fastai_course/.conda/bin/python -m ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"014642ec-c847-43b1-bdcb-b84f62fbbd66" --shell=9002 --transport="tcp" --iopub=9004 --f=~/Library/Jupyter/runtime/kernel-v2-3732XDKJ3gVWRH1P.json > cwd: ~/code/fastai_course 11:39:17.832 [info] ipykernel version & path 6.22.0, ~/code/fastai_course/.conda/lib/python3.11/site-packages/ipykernel/__init__.py for ~/code/fastai_course/.conda/bin/python 11:39:18.181 [warn] StdErr from Kernel Process 0.00s - Debugger warning: It seems that frozen modules are being used, which may 0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off 0.00s - to python to disable frozen modules. 0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation. 11:39:18.373 [info] Started Kernel .conda (Python 3.11.3) (pid: 19270) 11:39:18.373 [info] Started new session 92251653-320f-4506-9a53-cf65fbe7821f 11:39:18.374 [info] Shutdown old session 096dad14-72a3-41f5-a50f-c34163279236 11:39:18.374 [info] Dispose Kernel process 19218. ```

DonJayamanne commented 1 year ago

@epicwhale I'm very sorry for never gettinb back to you on this. Totally missed this issue. Yes, I can replicate this at my end as well, will look into this.

ice1x commented 1 year ago

In my case i have node OOM killed during the file uploading - VSCode in K8s (can't reproduce with same VSCode image in Docker-Compose):

[11:09:56] [127.0.0.6][6716a970][ExtensionHostConnection] <14138><stderr>  3: 0xa1b617 node::OOMErrorHandler(char const*, bool) [/opt/test/vscode/lib/code-server-4.16.1/lib/node]

[11:09:56] [127.0.0.6][6716a970][ExtensionHostConnection] <14138><stderr>  4: 0xad119b napi_fatal_error [/opt/test/vscode/lib/code-server-4.16.1/lib/node]
 5: 0x7fee71d312e3  [/opt/test/vscode/extensions/ms-toolsai.jupyter-2023.3.100-universal/out/node_modules/zeromqold/prebuilds/linux-x64/electron.napi.glibc.node]
 6: 0x7fee71d3f8f6  [/opt/test/vscode/extensions/ms-toolsai.jupyter-2023.3.100-universal/out/node_modules/zeromqold/prebuilds/linux-x64/electron.napi.glibc.node]

[11:09:56] [127.0.0.6][6716a970][ExtensionHostConnection] <14138><stderr>  7: 0x7fee71d34c23 zmq::OutgoingMsg::OutgoingMsg(Napi::Value, zmq::Module&) [/opt/test/vscode/extensions/ms-toolsai.jupyter-2023.3.100-universal/out/node_modules/zeromqold/prebuilds/linux-x64/electron.napi.glibc.node]
 8: 0x7fee71d34dfa zmq::OutgoingMsg::Parts::Parts(Napi::Value, zmq::Module&) [/opt/test/vscode/extensions/ms-toolsai.jupyter-2023.3.100-universal/out/node_modules/zeromqold/prebuilds/linux-x64/electron.napi.glibc.node]
 9: 0x7fee71d4afe4 napi_value__* Napi::ObjectWrap<zmq::Socket>::WrappedMethod<&zmq::Socket::Send>(napi_env__*, napi_callback_info__*) [/opt/test/vscode/extensions/ms-toolsai.jupyter-2023.3.100-universal/out/node_modules/zeromqold/prebuilds/linux-x64/electron.napi.glibc.node]

[11:09:56] [127.0.0.6][6716a970][ExtensionHostConnection] <14138><stderr> 10: 0xab380d  [/opt/test/vscode/lib/code-server-4.16.1/lib/node]

[11:09:56] [127.0.0.6][6716a970][ExtensionHostConnection] <14138><stderr> 11: 0xd3df8e  [/opt/test/vscode/lib/code-server-4.16.1/lib/node]

[11:09:56] [127.0.0.6][6716a970][ExtensionHostConnection] <14138><stderr> 12: 0xd3f3af v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/opt/test/vscode/lib/code-server-4.16.1/lib/node]

[11:09:56] [127.0.0.6][6716a970][ExtensionHostConnection] <14138><stderr> 13: 0x15d9f39  [/opt/test/vscode/lib/code-server-4.16.1/lib/node]
2023-10-31T11:09:56.857223101Z
[11:10:00] [127.0.0.6][6716a970][ExtensionHostConnection] <14138> Extension Host Process exited with code: null, signal: SIGABRT.
[11:10:00] [127.0.0.6][6716a970][ExtensionHostConnection] Unknown reconnection token (seen before).
[11:10:01] [127.0.0.6][9e0d2d32][ExtensionHostConnection] New connection established.
[11:10:01] [127.0.0.6][9e0d2d32][ExtensionHostConnection] <14264> Launched Extension Host Process.
[11:11:00] [127.0.0.6][9e0d2d32][ExtensionHostConnection] <14264> Starting WebSocket: RAW/api/kernels/9d30a371-027e-4d39-a5e9-855915a9fb64

[11:11:01] [127.0.0.6][9e0d2d32][ExtensionHostConnection] <14264> Kernel: starting (9d30a371-027e-4d39-a5e9-855915a9fb64)
2023-10-31T11:11:01.200548115Z
DonJayamanne commented 11 months ago

This seems to be an issue in the Juputer kernel itself, (i.e. can repro in Jupyter lab as well).

DonJayamanne commented 11 months ago

@ice1x @epicwhale I believe I have managed to fix this issue, apologies for the delay in getting to the bottom of this. The reason it took a while is because file upload was also broken in jupyter lab as well (at least when I was testing this), hence it was difficult to figure out what was broken and where

Please could you

If this still does not fix it, please feel free to re-open this issue or feel free to create a new one or just ping me here

Chaoses-Ib commented 10 months ago

I tested it on my machine. It fixed the issue and works great. But looks like it hasn't been released to the extension marketplace yet, may I know when it will be released?

DonJayamanne commented 10 months ago

please try vscode insiders, and install the pre-release version of the extension.