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

[html] tokenizer state holds attribute value and runs OOM #8647

Closed
TotzkePaul opened this issue Jul 1, 2016 · 9 comments
Closed

[html] tokenizer state holds attribute value and runs OOM #8647

TotzkePaul opened this issue Jul 1, 2016 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues verified Verification succeeded
Milestone

Comments

@TotzkePaul
Copy link

TotzkePaul commented Jul 1, 2016

  • VSCode Version: 1.3.0-insiders
  • OS Version: Windows 10 Enterprise

Steps to Reproduce:

  1. Install VS Code
  2. Open Folder with 12 Mb html file.
  3. "The window has crashed"

There isn't a noticeable increase in memory or CPU usage. Running as Admin or opening it as a single file makes no difference.

This seems similar to "Crashing/failing to open on new install #8400" except that it seems that I need to open a file first.

@bpasero
Copy link
Member

bpasero commented Jul 2, 2016

@TotzkePaul does it reproduce with our latest insiders build (see below)? can you attach the file please?

We are releasing preview releases of the next stable VS Code version for everyone to try and give feedback. These preview releases are not 100% tested and might be unstable but contain our latest features and bugfixes. You can give our preview releases a try from: http://code.visualstudio.com/Download#insiders

@bpasero bpasero added freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues editor labels Jul 2, 2016
@TotzkePaul
Copy link
Author

TotzkePaul commented Jul 5, 2016

It still fails on the latest nightly build.

It seems to be because there is a large amount of data in a value attribute. Removing that tag but leaving that data behind in a div doesn't cause an issue.

I was able to reproduce with non-useful data here:
https://github.com/TotzkePaul/SpacesVsTabs/blob/master/Test.html#L1

EDIT: I also have this issue with Atom. Maybe this isn't an issue with VS Code. Electron issue?

@alexdima
Copy link
Member

The crash is due to OOM

@alexdima
Copy link
Member

The problem is that the hand-written HTML tokenizer tries to build up the attributeValue in its State object and holds on to O(N^2) memory because each state is cloned at the beginning of a line.

@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Jul 12, 2016
@alexdima alexdima assigned jrieken and unassigned alexdima Jul 12, 2016
@alexdima
Copy link
Member

image

@TotzkePaul
Copy link
Author

So I removed all the "\n\r" from the file and I got "The window is no longer responding. You can reopen or close the window or keep waiting. I'm not sure if I understood what you meant.

@jrieken
Copy link
Member

jrieken commented Jul 13, 2016

@aeschli Correctly if I am wrong but we will change to textmate for html this milestone, right?

@aeschli
Copy link
Contributor

aeschli commented Jul 13, 2016

@jrieken Not sure if already in this milestone.
As it's going to stay in the standalone editor anyway, I will start working on a fix.
From what I see it's not really necessary to have the attribute value as part of the tokenizer state.

@aeschli aeschli assigned aeschli and unassigned jrieken Jul 13, 2016
@aeschli aeschli added this to the July 2016 milestone Jul 13, 2016
aeschli added a commit that referenced this issue Jul 13, 2016
aeschli added a commit that referenced this issue Jul 13, 2016
@aeschli aeschli closed this as completed Jul 19, 2016
@aeschli aeschli changed the title The window has crashed [html] tokenizer state holds attribute value and runs OOM Jul 19, 2016
@TotzkePaul
Copy link
Author

I tested it out and works great! thanks!

@joaomoreno joaomoreno added the verified Verification succeeded label Jul 28, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants