microsoft / vscode-jupyter

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

"Extension host terminated unexpectedly" when modifying markdown cell #1053

Closed cviguier closed 3 years ago

cviguier commented 4 years ago

Bug: Notebook Editor, Interactive Window, Editor cells

Steps to cause the bug to occur

Has been observed only for big notebooks but I couldn't identify a clear minimal reproducible example.

  1. Create a large notebook (>40MB) with plotnine plots with a few thousand points.
  2. Save and quit
  3. Open and edit a markdown cell.

Actual behavior

"Extension host terminated unexpectedly." error message, not able to save the file. Need to restart VSCode.

Expected behavior

Being able to modify a markdown cell and save.

Peek 2020-05-25 17-11

Your Jupyter and/or Python environment

Please provide as much info as you readily know

Developer Tools Console Output

DeepinScreenshot_select-area_20200525164737

Info Python Extension: 2020-05-25 16:45:12: Loading base colors from /home/fuelsave/.vscode/extensions/zhuangtongfa.material-theme-3.7.1/themes/OneDark-Pro.json ... 4console.ts:137 [Extension Host] Info Python Extension: 2020-05-25 16:45:12: Using colors to generate CSS ... webviewElement.ts:287 [Embedded Page] Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/Microsoft/monaco-editor#faq webviewElement.ts:287 [Embedded Page] Failed to construct 'Worker': Script at 'vscode-resource://file///home/fuelsave/Code/fs-reasearch/knowledge-repo/knowledge_repo/data_science/road_classification/editor.worker.js' cannot be accessed from origin 'null'. extensionHost.ts:212 Extension Host extensionHost.ts:213 Debugger attached. log.ts:191 WARN UNRESPONSIVE extension host, 'ms-python.python' took 62% of 3675.517ms, saved PROFILE here: '/tmp/exthost-2ef898.cpuprofile' (5) [{…}, {…}, {…}, {…}, {…}] extensionHost.ts:212 Extension Host extensionHost.ts:213 Debugger attached. extensionHost.ts:212 Extension Host extensionHost.ts:213 Debugger attached. extensionHost.ts:212 Extension Host extensionHost.ts:213 Debugger attached. log.ts:191 WARN UNRESPONSIVE extension host, 'ms-python.python' took 61% of 5242.676ms, saved PROFILE here: '/tmp/exthost-5e285a.cpuprofile' (3) [{…}, {…}, {…}] extensionHost.ts:212 Extension Host extensionHost.ts:213 FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory bootstrap-window.js:209 [uncaught exception]: Error: read ECONNRESET onUnexpectedError @ bootstrap-window.js:209 (anonymous) @ bootstrap-window.js:52 emit @ events.js:203 ./lib/renderer/init.ts.window.onerror @ init.ts:188 n.globals.onerror @ errorTelemetry.ts:20 bootstrap-window.js:212 Error: read ECONNRESET at Pipe.onStreamRead (internal/stream_base_commons.js:183) onUnexpectedError @ bootstrap-window.js:212 (anonymous) @ bootstrap-window.js:52 emit @ events.js:203 ./lib/renderer/init.ts.window.onerror @ init.ts:188 n.globals.onerror @ errorTelemetry.ts:20 events.js:180 Uncaught Error: read ECONNRESET at Pipe.onStreamRead (internal/stream_base_commons.js:183) errnoException @ internal/errors.js:463 onStreamRead @ internal/stream_base_commons.js:183 abstractExtensionService.ts:155 Extension host terminated unexpectedly. Code: null Signal: SIGABRT _onExtensionHostCrashed @ abstractExtensionService.ts:155 _onExtensionHostCrashed @ extensionService.ts:378 _onExtensionHostCrashOrExit @ abstractExtensionService.ts:147 (anonymous) @ abstractExtensionService.ts:137 fire @ event.ts:587 _onExtHostProcessExit @ extensionHost.ts:483 (anonymous) @ extensionHost.ts:228 emit @ events.js:203 ChildProcess._handle.onexit @ internal/child_process.js:272 notificationsAlerts.ts:40 Extension host terminated unexpectedly.

Did not solve the issue

I cannot provide the notebook.

Thank you in advance for your help.

IanMatthewHuff commented 4 years ago

@cviguier Thanks for reporting this and sorry about the issue here. I see that you can't provide the notebook, which I understand, but it might make it a bit harder to track down. I'll try to dig in on this myself creating a similar large notebook with plotnine plots today to see if I can repro. Does look like it might be a memory issue though, I agree.

If you do happen to run into this again, if you right click on the console tab in the developer tools you can save the entire console log as a file. If you do that you can just drag that full file into a message box comment here on github. Might help me to see the entire log.

cviguier commented 4 years ago

-1590507074384.log

@IanMatthewHuff THank you very much for the quick answer. Once it starts, the error is quite consistent. Please find the log attached. I hope it helps. Thank you again for your help.

IanMatthewHuff commented 4 years ago

I've been playing around with a big file with plotnine charts (10,000 elements, 40MB file size) and I'm currently unable to repro it, but I'm still trying. In those extension host warnings that you see before the crash while typing in the markdown. It looks like it's creating a cpuprofile file on your system. Could you attach one of those as well? Might let me see what it's churning on when editing in the markdown.

Also just to make sure, you are editing the markdown without even running the file after the re-open, right?

cviguier commented 4 years ago

Thank you for your effort. I will try to reproduce a notebook with the bug that can send you. Please find attached the cpuprofile it generates. Yes, I go straight to a markdown cell and I edit it.

exthost-6b3054.cpuprofile.txt

IanMatthewHuff commented 4 years ago

@cviguier If possible could you try downloading our newest development build and giving the same scenario a try? https://github.com/microsoft/vscode-python/blob/master/CONTRIBUTING.md#development-build Looking at the scenario I believe that our saving code might be a problem (as you type the notebook it is saving behind the scenes). Our new code has been refactored to save less often, so I believe that it would handle this scenario better.

cviguier commented 4 years ago

@IanMatthewHuff Thank you for the suggestion. After short experiments, it looks like it doesn't crash. I'll continue working on the document and see if I meet any problem. If Can finish my work without any trouble, I will close this issue.

I noticed some error messages, but I believe they are not related (but at rather related to Jedi, I messed with it as I saw it might have been a cause of my original problem). I'll attach the log if you want to have a look.

-1590655445037.log

Thank you for your help.

cviguier commented 4 years ago

Thank you very much for your help. It seems that using the dev version has stabilised the notebook.

IanMatthewHuff commented 4 years ago

Awesome and thanks for reporting this as well. While looking into this issue for you I think that I also noticed a related performance issue with notebook saving, should be able to clean that up as well and I wouldn't have noticed this without your report.

cviguier commented 4 years ago

You're welcome. I try my best to not open issues for nothing, but I was really struggling to find a solution to this problem. I'm happy this helped, because you helped me a lot. Cheers.