PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.7k stars 488 forks source link

Extension crashes/stops working when opening large JavaScript file #2920

Closed PrzemyslawKlys closed 4 years ago

PrzemyslawKlys commented 4 years ago

Issue Description

I am experiencing a problem with...extension crashing or just vanishing somewhere.

  1. Open PowerShell
  2. See it works
  3. Go and open minimized JS script (huge one I guess)
  4. Notice PS extension no longer works

ExtensionStopsWorking

1598604992-0f6cc825-a16d-4ba7-8b4a-7180a45d695a1598604991086.zip

Attached Logs

Follow the instructions in the README about capturing and sending logs.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.19042
VSCode 1.48.2
PowerShell Extension Version 2020.7.0

PowerShell Information

Name Value
PSVersion 5.1.19041.1
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.19041.1
BuildVersion 10.0.19041.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand) |Extension|Author|Version| |---|---|---| |better-toml|bungcip|0.3.2| |bracket-pair-colorizer-2|CoenraadS|0.2.0| |errorlens|usernamehw|3.2.1| |format-selection-as-html|adrianwilczynski|2.3.0| |github-linker|gimenete|0.2.3| |gitlens|eamodio|10.2.2| |line-endings|steditor|1.0.3| |markdown-all-in-one|yzhang|3.2.0| |material-icon-theme|PKief|4.2.0| |open-in-browser|techer|2.0.0| |powershell-preview|ms-vscode|2020.7.0| |project-manager|alefragnani|11.2.0| |run-in-powershell|tobysmith568|1.1.0| |vscode-markdownlint|DavidAnson|0.36.3| |vscode-toggle-quotes|BriteSnow|0.3.3| |vscode-wakatime|WakaTime|4.0.7| |vscode-yaml|redhat|0.10.1| |xml|DotJoshJohnson|2.5.1|
SydneyhSmith commented 4 years ago

Thanks @PrzemyslawKlys looking at the GIF we are having a bit of trouble understanding where the extension crash is happening, what behaviors/messages did you receive to know it had crashed?

PrzemyslawKlys commented 4 years ago
  1. Before I switch to JS in right bottom corner you can see 5.1 PowerShell - meaning extension is active
  2. When I switch to JS you see at the bottom - activating extension (middle of the screen)
  3. When you switch back to PowerShell, notice how in right bottom corner 5.1 is missing

Clearly minimized JS is making problems for Code, but it impacts PowerShell extension as well as it never recovers from that.

You can also see how the syntax highlighting goes from Green to Blue. Green is currently in PowerShell Preview syntax highlighting (it's supposed to be fixed) so what you see is that once you switch back monokai default theme takeover.

TylerLeonhardt commented 4 years ago

Gotcha, can you attach what you see in dev tools console tab?: image image

PrzemyslawKlys commented 4 years ago

image

PrzemyslawKlys commented 4 years ago

Hrms, actually PowerShell extension didn't crash. It's just waiting for very long time (1+ minute) and finally comes back. It seems minimized JS may be too big for Code and it halts everything until it's processed.

TylerLeonhardt commented 4 years ago

@PrzemyslawKlys very possible. That "UNRESPONSIVE" warning might be a clue that the bracket-pair-colorizer-2 is unable to handle it... just a guess.

rjmholt commented 4 years ago

Certainly an issue with node is that anything running on the event loop will block it for everything else. Despite two extensions being unrelated, one can block the event loop and cause the other to starve. It's likely that:

I think if you want to examine this further, it's worth doing some performance profiling of this, for example by building a flame graph. I suspect we would see that we're spending almost the full minute in the bracket colouriser.

PrzemyslawKlys commented 4 years ago

I don't think my skills allow me to debug this kind of application at this moment. I was more worried that the PS extension was crashing and that got me worried, but it seems I was just impatient. So I'll let it go, as I don't have to edit those minified files anyways, just rarely stumbling upon them. I could open the issue in Code but seeing as some more crucial ones like the newest git versions not working with linked files I'm gonna just skip it. Thank you for your assessment. I guess I could also try disabling bracket-pair-colorizer-2 as it could be the offender here - but I quite like it.