microsoft / vscode

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

The IDE keeps crashing #199960

Open php4fan opened 11 months ago

php4fan commented 11 months ago

I was editing a file and the IDE just crashed. A popup window showed up saying "Sorry for the inconvenience bla bla bla" and that I could "restart from where I left" or something like that, I don't remember the exact wording. There was a button that I don't remember whether it was "reopen" or "restore", and I clicked it, but it did NOT relaunch the IDE. I had to relaunch it manually.

Fortunately, most of the unsaved changes I had made to the current file (which got reopened when I manually launched the IDE again) were there, but not exactly everything. The last dozen or so keystrokes were lost.

I wasn't offered any option to upload a crash log or something like that.

What I would expect:

  1. The IDE should never, ever crash in the first place. Stability is the number one priority.
  2. If it does, everything to the very last keystroke must have been saved, and be restored upon restarting
  3. If it says it's going to reopen and offers me a button called "reopen" or "restore", I expect it to restore. Otherwise just tell me that I have to do it myself (but then again, why shouldn't be able to do it?)
  4. When there's a crash, you must indicate me at the very least where I can find a log, hopefully with relevant information about the crash or about what happened just before it, that I can upload here or wherever. Usually, decent software shows a button that automatically sends the relevant logs to the developers. I would be happy with just not having to look for the logs, or the menu option.

If there is some log that I can fetch, let me know so I upload it if it's not too late.

version 1.84.2 on Manjaro Linux

bpasero commented 11 months ago

Does this reproduce with some steps? Then there is ways to get a crash dump. Unfortunately there is no way to get a crash dump after the crash without running VS Code in a special way.

php4fan commented 11 months ago

Unfortunately there is no way to get a crash dump after the crash without running VS Code in a special way.

Wow. I think you should consider fixing that.

Does this reproduce with some steps?

Unfortunately not. Or should I say fortunately not.

bpasero commented 11 months ago

It can be enabled from the command line by passing --crash-reporter-directory=(path to a folder). We automatically upload all crash reports to analyse trends over all users, but that would not help in this case where we want a particular single instance.

If there is no repro, then I believe I cannot be of help for the crash at least.

RedCMD commented 11 months ago

I can confirm that the reopen button doesn't work after VSCode crashes

it's pretty easy to get VSCode to hang and crash with bad regex's in ctrl+F and textmate grammars etc

tho @php4fan didn't say VScode hung for any exteneded period of time before crashing

what language were you coding? and what extensions do you have installed

bpasero commented 11 months ago

@RedCMD on what platform did you see that "Reopen" does not work?

RedCMD commented 11 months ago

Windows 11 x64 .zip installation

bpasero commented 11 months ago

Please see if you can find any logged output that could help us find the source of the issue:

Thanks!

RedCMD commented 11 months ago

I just used the same type of regex from https://github.com/microsoft/vscode/issues/30874 image VSCode crash 20231205T213153.zip

bpasero commented 11 months ago

I can reproduce, but only when 1 window is opened:

I suspect that when you click "Reopen" with only 1 window open, we first close that window and then probably assume that we need to quit the application.

php4fan commented 11 months ago

In my case it didn't hang before crashing (or if it did it was for a very short time, no more than a couple of seconds). When the popup showed up, I'm almost sure the crashed windows had already vanished. Also, (again I'm almost sure) I had two windows opened when it crashed. I wasn't using Find.

bpasero commented 11 months ago

Thanks, I will try in both cases of having 1 or 2 windows open.

As for the part that you lost data: was the file saved or dirty? We keep track of saved states from the "Timeline" view in the explorer, but that requires the file to be saved.

php4fan commented 11 months ago

Now it would be great if you fixed the issue that actually makes VCS crash several times a day.

bpasero commented 11 months ago

Would love to, but it requires help from you:

Can you please follow the steps in https://github.com/Microsoft/vscode/wiki/Native-Crash-Issues to get at more details around the crash and attach the result here? Thanks!

php4fan commented 11 months ago

Can you please follow the steps in

The thing that I absolutely hate about that is that I need to run VSCode with a command line option. Either I need to run it from a terminal, which is annoying and I'll forget to half of the times, or I need to google how to add the command line option to whatever .desktop file I have somewhere, and find out where it is etc., i.e. a waste of time.

That option should be enabled by default. The very first time that the program crashes without me having foreseen anything, I should be able to find information about the crash (which is what I wanted to do the first time I encountered one of these crashes).

I hope that at the very least, crash reports are being generated and uploaded anyway by default, is that so?

Either way I'll try to do the above because I do want to know what progress is being made.

bpasero commented 11 months ago

Yeah I share the concern, and we have a way to solve this by allowing to configure runtime arguments into a file called argv.json in the user home dir. It currently does not allow to set this option but I will see to add it so that you configure this once and then VS Code will store the crash reports to the location you picked.

image

Thanks for trying to reproduce the crash even though its hard currently having to use the CLI option 🙏

php4fan commented 10 months ago

Finally two things coincided: that it crashed (that happens a lot) and that I had remembered to launch it from a terminal with the --crash-reporter-directory flag.

Here's the contents of the pending subfolder (the only one that is not empty) within the crash reporter directory.

Hope this contains enough information. The frequency of the crashes is absolutely pathetic.

pending.zip

php4fan commented 10 months ago

I've edited the title. I suggest to reopen this issue and use it to track the actual crashes, given that the "reopen" button not working is already tracked in another issue.

php4fan commented 10 months ago

Note that I'm observing the crashes on Manjaro Linux, not Windows.

deepak1556 commented 10 months ago

Side note: crash dumps are also persisted to the application user data directory, so you can always find them even when running without the --crash-reporter-directory. Run Developer: Open User Data Folder and under Crashpad/completed you should find the relevant files that can be attached to this issue.

deepak1556 commented 10 months ago

The attached crash report indicates a crash due to OOM in the workbench, @php4fan please follow the steps below to get additional trace data,

php4fan commented 10 months ago

Now perform the operations that will lead up to the crash,

I don't know of any particular operations that will lead to the crash. It happens randomly as far as I know. Can I leave the allocation sampling running for hours while I use Code normally?

Side note: crash dumps are also persisted to the application user data directory, so you can always find them even when running without the --crash-reporter-directory.

But are they generated if the crash happens when running without the flag?

deepak1556 commented 10 months ago

Can I leave the allocation sampling running for hours while I use Code normally?

It would be better if you can get a reliable repro or pattern to when the crash happens, you can leave the sampler running but it needs to be stopped before the crash since the debugger will auto disconnect when that happens.

But are they generated if the crash happens when running without the flag?

Yes they are generated only when running without the flag, the flag will change the directory for storage so the two are exclusive.

php4fan commented 10 months ago

Yes they are generated only when running without the flag, the flag will change the directory for storage so the two are exclusive.

Oh I see, so what did @bpasero mean by:

Unfortunately there is no way to get a crash dump after the crash without running VS Code in a special way.

? Apparently I misunderstood it as "there is no way to get a crash dump after the crash without running VS Code in a special way" and we wasted a month when I could have got the crash dumps since day one. In fact they seem to be still there, I attach them: completed.zip

It would be better if you can get a reliable repro or pattern to when the crash happens

Yeah, unfortunately there doesn't seem to be any easily discernible pattern; I don't think I'll be able to find a reliable repro anytime soon.

The instructions for collecting the memory profile are confusing.

  • Now perform the operations that will lead up to the crash, click on Collect Garbage icon in the developer tools Memory tab a couple of times in between the editor operations
  • Save the trace and attach it to this issue thread

How am I supposed to save the trace after Code has crashed?

but it needs to be stopped before the crash

Oh, before it crashes? So, (assuming I know how to make it crash on purpose), I need to stop "just before", meaning "one step" before I trigger the crash (according to some subdivision of steps), and with the hope that even omitting the very last step that triggers the crash, the profile will still contain useful information?

Anyway, without being able to trigger the crash at will or predict when it will occur, that is not viable.

php4fan commented 10 months ago

The crashes continue to happen.

If the crash dumps are not enough to investigate the issue, please let me know what else I can provide that is actually doable, as opposed to what requested in https://github.com/microsoft/vscode/issues/199960#issuecomment-1878150356 which I will not realistically be able to provide during my lifetime.

Please remember that there are no known reproduction steps that I know of and I cannot reproduce the crashes at will, other than using the IDE while doing my job and waiting for a crash to happen.

deepak1556 commented 10 months ago

Please check if the crashes happen with our insiders version https://code.visualstudio.com/insiders, use a new profile via Profiles: Create a Temporary Profile to confirm.

javierdebug commented 10 months ago

Please check if the crashes happen with our insiders version https://code.visualstudio.com/insiders, use a new profile via Profiles: Create a Temporary Profile to confirm.

Hey, I've been experiencing these crashes since last week. I tested with the insider' version, and it also happens. :cry:

Version: 1.86.0-insider
Commit: 271fb7fbd599b49a1482ea7284a50b3229317f96
Date: 2024-01-19T05:36:44.367Z
Electron: 27.2.1
ElectronBuildId: 26149897
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Linux x64 5.15.0-91-generic
deepak1556 commented 10 months ago

@javierdebug can you share the crash dumps following the steps in https://github.com/microsoft/vscode/issues/199960#issuecomment-1878124568

javierdebug commented 10 months ago

@javierdebug can you share the crash dumps following the steps in #199960 (comment)

@deepak1556 I hope this helps to resolve the issue. I don't know how to visualize these files, but I obtained them from that folder. I attached the files from different times the app crashed:

completed.zip

completed-recent.zip

deepak1556 commented 10 months ago

@javierdebug thanks for the crash logs, they are different from the current issue. Your scenario is same as https://github.com/microsoft/vscode/issues/202255, as a next step can you try https://github.com/microsoft/vscode/issues/202255#issuecomment-1887779633

vscodenpa commented 10 months 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!