Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editor becomes unresponsive all the time since last update #7391

Closed
preexo opened this issue Jun 8, 2016 · 36 comments
Closed

editor becomes unresponsive all the time since last update #7391

preexo opened this issue Jun 8, 2016 · 36 comments
Assignees
Labels
freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues important Issue identified as high-priority verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@preexo
Copy link

preexo commented Jun 8, 2016

  • VSCode Version:1.2.0
  • OS Version:Windows 10

Steps to Reproduce:

  1. Open Visual Studio Code
  2. Update to latest version

I just updated my Visual Studio Code to the latest version. Congratulations, since then it is unresponsive all the time. I can work for a few seconds, then I hit a key, it freezes and can only be solved by killing the process through task manager...
It was running nice and smooth before the latest update, which I got today. Sadly I can't work like this and need a reliable editor, so I have to go back to use something else now.

Good luck.

@danielepolencic
Copy link

danielepolencic commented Jun 8, 2016

Since the last update, the editor is very slow for me too. I'm on Mac (10.10.5) and I just upgraded to 1.2.0

EDIT: I run VS Code vanilla. No plugins.

@doyint
Copy link

doyint commented Jun 8, 2016

I am experiencing the same thing to plus saving the JS file the title are start to flicker and will not save.

@workingj
Copy link

workingj commented Jun 8, 2016

I am experiencing the same thing if i open a third file-tab.
It also does not refresh the window if i (alt-tab) into an other open programm, like browser etc.
_ Edit: I work on Windows 7._

@calebegg
Copy link

calebegg commented Jun 9, 2016

I'm also seeing a lot of freezing with the latest update. I can generally only go ~10 minutes between freezes, and when it freezes all I can do is kill the whole process. Is there somewhere we can look for crash dumps/log files?

1.2.0 on Ubuntu 14.04; I almost exclusively use VSCode for TypeScript.

@alexdima alexdima added the important Issue identified as high-priority label Jun 9, 2016
@alexdima
Copy link
Member

alexdima commented Jun 9, 2016

I am sorry you are experiencing this. To help us reproduce, can you please give us more details. Is there a common pattern between these freezes (I see that they occur on Windows 10, Windows 7, Ubuntu and Mac), so I'm thinking they are not OS specific (if they have the same root cause).

What sort of languages are you working on? I see TypeScript and JavaScript mentioned. Is that true for everybody? We have had quite a few issues with the TS/JS grammars (sometimes they recurse to death). Is it possible that this happens when opening a certain file or a file containing a certain pattern that would cause the grammars to go crazy?

We would appreciate any other details to repro this.

@alexdima alexdima added the freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues label Jun 9, 2016
@alexdima
Copy link
Member

alexdima commented Jun 9, 2016

Are you using the new integrated terminal?

@bpasero bpasero added this to the June 2016 milestone Jun 9, 2016
@bpasero bpasero added the candidate Issue identified as probable candidate for fixing in the next release label Jun 9, 2016
@calebegg
Copy link

calebegg commented Jun 9, 2016

Are you using the new integrated terminal?

I'm not.

We would appreciate any other details to repro this.

I tried it a bit more today, and, at least for me, it seems to always happen when I try to save. I press ctrl+S, but the save operation never completes (the black dot never goes away, and the file never actually gets saved). I then have to kill the process and try again. It happens maybe 5-10% of the time (or less) when I try to save (most save operations are successful and instant)

The files I'm editing are on a networked filesystem, which might be related, though I'm confident that that's not the direct cause, because (a) this has always worked in previous versions and (b) I'm not seeing this problem in other editors, including a 1.1 install of VS Code.

@doyint
Copy link

doyint commented Jun 9, 2016

That's exactly the same thing for me, I think it might be .js file related because I have some html and php file open in different tabs and it never happened on those files, I initially thought it might be because the terminal was opened, but that wasn't the case, and I also thought it may be because their is a grunt watchify on the folders I am working on, but it's wasn't the case either, I have also started removing some plugins, which initially things seems fine, so I would attribute that to the plugin bug. But then I am still getting the same issue again.

Windows 7
I am on cooperate network.

I installed V1.1 to see if I could revert back but that problem still occurred.
I am back on v1.2

Temporary solution for now is:
After press CTRL + S to save, the flickering starts to happen, as if it's trying to save but then cant save which sends it's in a endless loop.
If I press CTRL + Z, to undo, it will stop and eventually save the file, the implication of that is, I lose the complete history of the file, so I can't further undo any actions, prior to me saving it.
Solution B: Sometimes I also find if the flickering is happening, if I switch to debug to view git file changes, then this also terminate the flickering and saves the file also. Again I still lose the file history meaning I can't undo any changes made prior.

It's a pain to work with now.

I hope this is enough information.

@preexo
Copy link
Author

preexo commented Jun 10, 2016

I am using VS code only for PHP programming. I could use it a few seconds, a couple of keystrokes and it would freeze and never wake up again.
I just gave it another try and just uninstalled, then reinstalled it. It seems fine for now.

Even though all users are describing similar symptoms, we all seem to use it a tiny bit different and therefore it might all be related to completely different problems.

Anyway, it works fine for me at the moment.

Is there no debug more with log files or anything that we could append the next time this happens?

@bpasero
Copy link
Member

bpasero commented Jun 10, 2016

@preexo @doyintade @calebegg are you guys using a specific version of Git or maybe GitHub for Windows? Does it reproduce if you disable Git via settings (git.enabled: false) after a restart?

@preexo
Copy link
Author

preexo commented Jun 10, 2016

@bpasero - The freezing problems just started again. I am using Smartgit on Windows 10, which includes some kind of git for windows.

I changed the setting as you suggested, now it runs fine again, at least for the last half an hour.

@joaomoreno
Copy link
Member

@preexo, what do you get when running git status from that same folder?

@bpasero
Copy link
Member

bpasero commented Jun 10, 2016

@preexo can you quickly check if this is reproducible in our previous version (https://az764295.vo.msecnd.net/stable/def9e32467ad6e4f48787d38caf190acbfee5880/VSCode-darwin-stable-unsigned.zip). Make sure to enable git again.

@preexo
Copy link
Author

preexo commented Jun 10, 2016

@joaomoreno - git status gives me the expected modified file, I have been working on:

git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   modules/PDFMaker/resources/functions/msa.php

no changes added to commit (use "git add" and/or "git commit -a")

@bpasero - your link looks like the OSX app, I am running windows 10.

@bpasero
Copy link
Member

bpasero commented Jun 10, 2016

@preexo
Copy link
Author

preexo commented Jun 10, 2016

@bpasero - yes, I can reproduce it. Started the old version, changed the config back. The same thing happens with the version you gave me there.

But it has never happened before. I was using the editor for a while already without trouble and never changed the git.enabled default value.

@preexo
Copy link
Author

preexo commented Jun 10, 2016

I went back to 1.2.0 and disabled the git again... Just had another freeze. This is completely random. I don't think that this trial and error procedure will get us anywhere. Is there no debug mode and log file that would just tell you what actually goes wrong, where it explodes?

@bpasero
Copy link
Member

bpasero commented Jun 10, 2016

@preexo are you restarting when making the git change?

@doyint
Copy link

doyint commented Jun 10, 2016

@calebegg
Copy link

@bpasero: Not using Git, though apparently I have 2.8.0 installed. Tried disabling it and that didn't fix it apparently. It happened again within a few minutes.

@bpasero
Copy link
Member

bpasero commented Jun 10, 2016

@calebegg can you open the chrome developer tools and hit the profile button from the profile tab to measure a bit where this time is spend?

@bpasero bpasero modified the milestones: Backlog, June 2016 Jun 22, 2016
@calebegg
Copy link

@bpasero Any more updates on this? I see you tagged "needs more info" -- what can I do to help you diagnose? This is still happening very frequently for me.

@calebegg
Copy link

I tried using strace to attach to what I assume is the renderer process (I guessed that the one with highest CPU would be the renderer) and I found that right before vscode freezes, this process crashes, and it looks like it sends a crash report. Is there some data I can give to you to help track down the crash report on your end? The vscode_sessionId is given from strace as "890d6112-675f-40fb-89df-c00cc4a7"

@bpasero
Copy link
Member

bpasero commented Jun 25, 2016

Best would be a memory profile when memory is growing but before VS Code crashes with out of memory (at ~1 GB). Typically the crash report does not help us much because it just indicates that there was an out of memory. It does not tell us which area caused it unfortunately.

@calebegg
Copy link

I found a good way to reproduce it consistently: I have a very large (1.7MB, 37K lines), generated .d.ts file as part of my project, and if i open it, VSCode crashes after a few seconds. I don't normally have to open it, but it seems that even if I edit a file that depends on it and do certain things, like hovering over a symbol in that file for a few seconds, VSCode (it looks like) tries to load/parse that large file, and crashes within a few seconds. While it's working, I see "Loading..." in the tooltip.

Is there any way to make vscode never look at the file (only let the TS language service see it?) Maybe if this is a common problem, you could introduce a file size limit above which VSCode will not attempt to parse a file?

Alternatively, is there a way to bump up the memory that VSCode will use so maybe it can parse the large file without choking?

I have a heap snapshot from before the crash, at about 618 MB used. I also have a memory timeline. 82% of the retained size usage from the heap snapshot is instances of StackElement, which seems to be something to do with syntax highlighting as far as I can tell. In a "normal" (not about to crash) heap snapshot, StackElement takes up only 8KB.

@bpasero
Copy link
Member

bpasero commented Jun 27, 2016

@calebegg thanks, that points to an issue with the language service and or editor.

@dbaeumer dragging you in and freeing myself, because I have 7 other freeze-slow-crash issues to look at.

@bpasero bpasero assigned dbaeumer and unassigned bpasero Jun 27, 2016
@bpasero
Copy link
Member

bpasero commented Jun 27, 2016

@calebegg are you able to attach this file here?

@calebegg
Copy link

Unfortunately, it contains proprietary code, but I will try to create a version of it without any. (It was generated with https://github.com/angular/clutz).

@calebegg
Copy link

Here's a similar file that kills my VSCode within a few seconds. 96K lines, 3.9MB.

http://ca.lebe.gg/files/out.d.ts

Like I said, I don't necessarily expect VSCode to be able to handle such large, generated files, but the problem is that if I depend on a symbol from this file elsewhere, it also seems to crash VSCode eventually.

Also, if it helps, my deps on files of this size worked fine pre-1.2. This all only started with VSCode 1.2.

@bpasero bpasero added the important Issue identified as high-priority label Jun 27, 2016
@alexdima
Copy link
Member

@calebegg Thank you so much for the repro file! I can immediately reproduce.

fyi @egamma @aeschli

It is the TypeScript TM grammar. I have done the following change in our code:
image

The grammar keeps on pushing states and never leaves them. Again!

[15740:0628/125238:INFO:CONSOLE(218)] "SCOPES CNT: 429", source: file:///C:/Alex/src/vscode/out/vs/editor/node/textMate/TMSyntax.js (218)
[15740:0628/125238:INFO:CONSOLE(218)] "SCOPES CNT: 429", source: file:///C:/Alex/src/vscode/out/vs/editor/node/textMate/TMSyntax.js (218)
[15740:0628/125238:INFO:CONSOLE(218)] "SCOPES CNT: 428", source: file:///C:/Alex/src/vscode/out/vs/editor/node/textMate/TMSyntax.js (218)
[15740:0628/125238:INFO:CONSOLE(218)] "SCOPES CNT: 428", source: file:///C:/Alex/src/vscode/out/vs/editor/node/textMate/TMSyntax.js (218)
[15740:0628/125238:INFO:CONSOLE(218)] "SCOPES CNT: 426", source: file:///C:/Alex/src/vscode/out/vs/editor/node/textMate/TMSyntax.js (218)
[15740:0628/125238:INFO:CONSOLE(218)] "SCOPES CNT: 428", source: file:///C:/Alex/src/vscode/out/vs/editor/node/textMate/TMSyntax.js (218)
[15740:0628/125238:INFO:CONSOLE(218)] "SCOPES CNT: 429", source: file:///C:/Alex/src/vscode/out/vs/editor/node/textMate/TMSyntax.js (218)
[15740:0628/125238:INFO:CONSOLE(218)] "SCOPES CNT: 429", source: file:///C:/Alex/src/vscode/out/vs/editor/node/textMate/TMSyntax.js (218)
[15740:0628/125238:INFO:CONSOLE(218)] "SCOPES CNT: 429", source: file:///C:/Alex/src/vscode/out/vs/editor/node/textMate/TMSyntax.js (218)
[15740:0628/125238:INFO:CONSOLE(218)] "SCOPES CNT: 429", source: file:///C:/Alex/src/vscode/out/vs/editor/node/textMate/TMSyntax.js (218)

This means that the grammar has a scope stack of depth 429, causing each token to have 429 scopes. It leads us to a DoS through OOM.

I am not sure when we last updated the TS grammar and why it started showing up in 1.2. @aeschli ?

@aeschli
Copy link
Contributor

aeschli commented Jun 28, 2016

There were 2 update to TS in 1.3:
700d736 and 88f88a9

@alexdima
Copy link
Member

@aeschli I can reproduce on master

Also, if it helps, my deps on files of this size worked fine pre-1.2. This all only started with VSCode 1.2.

So we need to assume the bad grammar change got in first in 1.2

@calebegg
Copy link

It could also be that the pre-parsing of files that aren't open in the editor got introduced (I assume to speed up opening times) in 1.2. I have no idea, though.

@dbaeumer dbaeumer removed their assignment Jun 29, 2016
@dbaeumer
Copy link
Member

Removing my assignment since this is in very good hands.

@alexdima alexdima removed the info-needed Issue requires more information from poster label Jun 29, 2016
@alexdima
Copy link
Member

alexdima commented Jul 1, 2016

After adopting vscode-textmate@2.0.1 (see #7912) (where the StackElement is immutable) this .d.ts does not cause an OOM for me anymore:

image

It is significant to note that the TypeScript grammar gets so broken for this example that at the end of the file it has entered 7152 rules that are not left!!! I will create a separate bug for them.

The good thing is we no longer crash.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues important Issue identified as high-priority verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests