microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
160.22k stars 28.06k forks source link

Notebooks can prevent shutdown when saving notebooks hangs #216582

Open thistlillo opened 2 weeks ago

thistlillo commented 2 weeks ago

I have several Jupyter notebooks on my local machine with unsaved changes and unfortunately decided to quit the app (CMD+Q) (forgetting to save all the unsaved changes).

I got this dialog:

Screenshot 2024-06-19 at 08 44 36

So I am stuck. I have files with unsaved changes, I cannot stop the "saving" operation and try something else. I can only "quit anyway" and lose all the changes.

The files are on my machine, so this error does not depend on network errors.

This is a funny bug, may be vere easy to solve by adding a "cancel" button.

Specs:

Visual Studio Code: Version: 1.89.1 Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685 Date: 2024-05-07T05:14:32.757Z (1 mo ago) Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Darwin arm64 23.5.0

bpasero commented 2 weeks ago

At that point when the dialog opens, there is no way of "Cancel" because a lot of other components may have already shut down. For a long time we did not even have a "Quit Anyway" button, leaving you with no option other than waiting or killing the app.

You should not loose data though, because of "hot exit", a backup of your unsaved changes should restore, even when you click "Quit Anyway". Can you confirm?

Would be interesting to figure out why you see this, any steps?

bpasero commented 2 weeks ago

Oh, you mention that you are using notebooks. This is interesting because we made recent changes that notebooks get saved from the extension host.

@amunger fyi, have you seen this before? I assume, saving a notebook might now take longer because its delegated to the extension host?

thistlillo commented 2 weeks ago

Would be interesting to figure out why you see this, any steps?

I can only add that initially I had two VSC windows open.

Window B) got "stuck" on "saving" due to network issues, but I was able to close it using menu commands. Then, I hit cmd+q and Window A got stuck on that dialog. I have waited for several minutes before clicking on "quit anyway".

It looks like I haven't lost any changes to the files.

Thanks.

amunger commented 2 weeks ago

We haven't started rolling out the EH saving for notebooks to stable yet because of an issue that was fixed after release, so unless manually configured, it should still be saved on the renderer.

@thistlillo - do you have "notebook.experimental.remoteSave": true in your settings?

I have seen some long saves myself a few times for small notebooks, in the 10-20 seconds range, and there have been other mentions from users, but I haven't been able to track anything consistent down yet.

VSCodeTriageBot commented 6 days ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

thistlillo commented 4 days ago

@thistlillo - do you have "notebook.experimental.remoteSave": true in your settings?

No, I have the key, but its value is false.

Screenshot 2024-06-29 at 20 38 19