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

VS Code crashes with minimap and bracket colorizer enabled on large file #140661

Closed
jvilk-stripe opened this issue Jan 13, 2022 · 7 comments
Closed
Assignees
Labels
outline Source outline view issues perf
Milestone

Comments

@jvilk-stripe
Copy link

jvilk-stripe commented Jan 13, 2022

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.62.1
  • OS Version: Mac OS X 12.0.1

Steps to Reproduce:

  1. Enable minimaps.
  2. Enable the VS Code bracket colorizer.
  3. Launch VS Code with --disable-extensions
  4. Open a 5MB JavaScript file.
  5. VS Code crashes (becomes unresponsive, prompts to reopen or wait)

I have attached a gzipped file which reproduces the issue:

big.js.gz

You may be wondering, "why on earth do we have a 5MB JavaScript file?" The answer... is codegen. :)

A simplish fix for us would be to let us disable minimap on large files.

@alexdima
Copy link
Member

This did not crash for me and I couldn't find a problem with the minimap. On my machine, it allocates 3x 540KB buffers for the pixels, but otherwise it seems to be running fine. After a lot of waiting, I was even able to generate a heap snapshot.

@jrieken the OutlineModel stood out to me at 60MB and another 30MB are counted inside the Objects first row for an object referenced via a field called _requests. Reach out to me in the next couple of days if you want the saved heap snapshot (>50MB).

image

@alexdima alexdima assigned jrieken and unassigned alexdima Jan 13, 2022
@jvilk-stripe
Copy link
Author

OK, update on my end: This does not happen in an empty workspace.

It happens 100% of the time when I open VS Code to our monorepo and open the file:

code --disable-extensions ~/path/to/stripe/monorepo
# then, I open big.js

I have no other files open, just big.js. Is there any debug info I might be able to fetch for you?

@jvilk-stripe
Copy link
Author

@alexdima Figured it out. Enable the bracket colorizer, and it reproduces!

{
  "editor.bracketPairColorization.enabled": true
}

I'll update the ticket above.

@jvilk-stripe jvilk-stripe changed the title VS Code crashes with minimap enabled on large file VS Code crashes with minimap and bracket colorizer enabled on large file Jan 13, 2022
@gjsjohnmurray
Copy link
Contributor

@jvilk-stripe are you able to update to latest Stable version, 1.63.2, then re-test?

@jvilk-stripe
Copy link
Author

I just downloaded the latest stable version and it does not reproduce!

Sorry for the noise, everyone -- we delay the rollout of new versions internally. :)

@jrieken jrieken assigned alexdima and jrieken and unassigned jrieken Jan 14, 2022
@jrieken
Copy link
Member

jrieken commented Jan 14, 2022

The _requests field is a LRU cache of the last few outline models. This is to ensure speedy outline/breadcrumbs while switching between files. Tho, it isn't very smart as the cache key includes the model version, meaning there will be entries kept in cache that won't ever be used again. I am planning some refactorings as part of #140557 and I can fix this too. Unsure about the model itself and if bytes should be squeezed or not

@jrieken jrieken added this to the January 2022 milestone Jan 14, 2022
@jrieken jrieken added outline Source outline view issues perf labels Jan 14, 2022
@alexdima alexdima removed their assignment Jan 17, 2022
sourcegraph-bot pushed a commit to sgtest/megarepo that referenced this issue Jan 18, 2022
sourcegraph-bot pushed a commit to sgtest/megarepo that referenced this issue Jan 18, 2022
@jrieken
Copy link
Member

jrieken commented Jan 24, 2022

Closing after fixing a couple of outlines related things

  • don't cache outline for N-1 version of one model
  • don't cache outline for disposed models
  • keep only one copy in cache

@jrieken jrieken closed this as completed Jan 24, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outline Source outline view issues perf
Projects
None yet
Development

No branches or pull requests

4 participants