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

Language Features still stops working after a while and never recovers #2627

Closed
PrzemyslawKlys opened this issue Apr 11, 2020 · 202 comments
Closed

Comments

@PrzemyslawKlys
Copy link
Contributor

Issue Description

I am experiencing a problem with...IntelliSense not working after a while.

I am aware of a recent fix and other closed issues:

But I still experience issues, far less but still.

Attached Logs

1586591887-8aec1d54-a22f-4e9a-9d5a-026cf95b0ba11586539769772.zip

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.18363
VSCode 1.44.0
PowerShell Extension Version 2020.4.1

PowerShell Information

Name Value
PSVersion 5.1.18362.752
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.18362.752
BuildVersion 10.0.18362.752
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
autoit Damien 1.0.4
beautify HookyQR 1.5.0
bracket-pair-colorizer-2 CoenraadS 0.0.29
code-settings-sync Shan 3.4.3
codesnap adpyke 1.0.27
excel-to-markdown-table csholmq 1.2.2
gistfs vsls-contrib 0.0.65
github-linker gimenete 0.2.3
gitlens eamodio 10.2.1
html-preview-vscode george-alisson 0.2.5
markdown-all-in-one yzhang 2.8.0
markdown-preview-enhanced shd101wyy 0.5.2
markdown-shortcuts mdickin 0.12.0
material-icon-theme PKief 4.0.1
pdf tomoki1207 0.5.1
powershell-preview ms-vscode 2020.4.1
project-manager alefragnani 10.11.0
reg ionutvmi 1.0.1
theme-monokai-pro-vscode monokai 1.1.15
vscode-html-css ecmel 0.2.3
vscode-markdownlint DavidAnson 0.34.0
vscode-pull-request-github GitHub 0.15.0
vscode-toggle-quotes BriteSnow 0.3.2
vscode-versionlens pflannery 0.25.0
vscode-wakatime WakaTime 4.0.0
vscode-yaml redhat 0.7.2
xml DotJoshJohnson 2.5.0
@ghost ghost added the Needs: Triage Maintainer attention needed! label Apr 11, 2020
@TylerLeonhardt
Copy link
Member

Honestly, at this point, the problem has to be deep in PowerShell Editor Services's handling of the PowerShell runspace.

I've tried to avoid diving into that as it will take a lot of time and will involve coordinating with @daxian-dbw on PSReadLine but unfortunately that's where we're at.

I'll need more people to bother @SteveL-MSFT here and on Twitter to treat this as a priority.

@mrboring
Copy link

@TylerLeonhardt I experienced this once yesterday. I commented here as #2522 is now closed.

@daxian-dbw
Copy link
Member

I also experienced the same with PowerShell extension 2020.3.0 with PowerShell 7.0.

Basically, intellisense stops working after a while. Then, if you run a command in the integrated console, it doesn’t get executed, but instead the command prompt will be displayed immediately, and after that things starts to work again. But the same will happen after a while again.

@PrzemyslawKlys
Copy link
Contributor Author

Maybe related: #2364

@TylerLeonhardt
Copy link
Member

@daxian-dbw the Preview extention has a bunch of work in it to prevent this... But this issue claims it isn't completely fixed.

@rkeithhill
Copy link
Contributor

rkeithhill commented Apr 21, 2020

I'm seeing a similar issue and I never started a debug session. I'm on preview 2020.4.2 (VSCode 1.44.2) and here's my log zip. I'm not seeing anything obvious here. BTW it is cool that cancel requests indicate the message number they're cancelling. I just wish the original LSP msgs displayed their request number.
EditorServices.zip

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Apr 21, 2020
@rkeithhill
Copy link
Contributor

OK, my PSIC is completely unresponsive which would explain why completions aren't working. :-) Now, why is PSIC wedged?

@PrzemyslawKlys
Copy link
Contributor Author

Weirdly enough when I deleted PS extension and reinstalled it everything seemed snappier. But it came back to being slow after a while. I restart PS Extension about 3 times per hour now.

@mattpwhite
Copy link

But this issue claims it isn't completely fixed.

I still find myself having to kill the extension multiple times every day. I think things have improved for sure, but it's still basically reliable. Ironically, I tend to keep my modules a single huge files in part because the extension is unreliable, which in turn seems to make the extension less reliable. I get that working in a 10K LoC module file is not the common case for a PS user, but I don't think it's completely crazy/unreasonable.

@PrzemyslawKlys
Copy link
Contributor Author

I use multifile, multifolder modules. But its random. I can open fresh session and even on very small codebase it chuckles on Get-content parameters.

@bspach
Copy link

bspach commented Apr 22, 2020

Issue seems worse in v2020.4.0... stops working after 3-5 minutes.

@rkeithhill
Copy link
Contributor

@bspach when completions stop working, is your PS integrated console also unresponsive?

@bspach
Copy link

bspach commented Apr 22, 2020

Integrated console works fine; Ctrl+Space immediately pops up all available cmdlet arguments in PSIC.

Edit: I let Code sit idle for about 15 minutes (afer loading a PS script into the editor) and now intellisense is working quickly/responsively, only a 1-3 second pause before the available options pop up when hitting Ctrl+Space or typing a "-".

Edit 2: Works inconsistently... stopped working again after a few minutes.

@bgelens
Copy link

bgelens commented Apr 22, 2020

I have the same thing. Also F8 will stop working but PSIC is still responding when used directly

@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Apr 28, 2020
@PrzemyslawKlys
Copy link
Contributor Author

I've updated to newest preview and the issue is still there. It's pretty much unstable. Formatting stops working, so does IntelliSense. This issue kills so much productivity.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Apr 29, 2020
@TylerLeonhardt
Copy link
Member

@PrzemyslawKlys do you think it's gotten worse or is about the same?

@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Apr 29, 2020
@PrzemyslawKlys
Copy link
Contributor Author

@TylerLeonhardt Between last 2 versions, same. But i am in situation where I have to restart 5 times in an hour to get formatting/intellisense.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Apr 29, 2020
@TylerLeonhardt
Copy link
Member

Just so you know, I am working on this, though not directly writing code just yet.

  1. I'm eagerly awaiting this PR in the library that we use which will increase the performance and stability at that layer - Rework ProcessScheduler OmniSharp/csharp-language-server-protocol#228
  2. Setting up a meeting with @BrucePay and @daxian-dbw to have them audit the code that we have now to see if they have ideas for improvements.

So things are happening... I've not given up on this.

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Jun 1, 2020

Anyway, this should be a new issue though. Let's start a "Workaround when a module takes too long to run Get-Help"

@PrzemyslawKlys can you do that and include your logs?

@PrzemyslawKlys
Copy link
Contributor Author

I've just uninstalled it (as I said, I don't use it), but I guess this could be a good feature, and I can open it up for the sake of getting things done :) The thing is - how do we know what's causing issues? If you don't automate the detection of that stuff most people will ignore your "work" on the new feature.

@TylerLeonhardt
Copy link
Member

Yeah we can possibly detect how long it takes and recommend ignoring a module...

@TylerLeonhardt
Copy link
Member

Ok I'm going to close this issue now! Let me know if anyone feels otherwise...

@PrzemyslawKlys
Copy link
Contributor Author

PrzemyslawKlys commented Jun 1, 2020

What about my issue with non-existing functions that cause IntelliSense to stop working? Should I open new issue?

@TylerLeonhardt
Copy link
Member

Does that still repro after uninstalling the AWS module? Because this discussion spawned from those logs.

@PrzemyslawKlys
Copy link
Contributor Author

It does not! I thought it's not related. That's cool! thnx

@SeeminglyScience
Copy link
Collaborator

SeeminglyScience commented Jun 1, 2020

@PrzemyslawKlys Yeah, but also try it again now that you have AWS uninstalled. The big problem with wildcard manifests is that they slow down command discovery globally. So if you try to look up a command that doesn't exist, all of that extra lookup time is going to hit every single time. Posted too late 🙂 already answered.

@PrzemyslawKlys
Copy link
Contributor Author

PrzemyslawKlys commented Jun 1, 2020

Just a quick question - would it make sense to ask PowerShellGallery to take out that number of cmdlets limit and then ask ASWPowerShell to fix it? Or is it an internal PowerShell limit that prevents this? Because the only reason they do this is because of PowerShellGallery right?

@SeeminglyScience
Copy link
Collaborator

@PrzemyslawKlys might be a good thing to bring up on the PowerShell repo.

Though I would say they should probably look at reducing the number of commands they export in a single module.

@TylerLeonhardt
Copy link
Member

Let me follow up internally.

@scrthq
Copy link

scrthq commented Jun 2, 2020

@SeeminglyScience They already solved for that by breaking the main AWSPowerShell module down into the service specific AWS.Tools.* modules.

@PrzemyslawKlys - if you haven't switched yet and have the option to do so, I highly recommend.

@PrzemyslawKlys
Copy link
Contributor Author

@scrthq well they didn't fix it. They should use the meta module because a lot of people still use the old one, and they will have the same problems as I did. It has 500k downloads per version. Can you try to ask them to just meta it?

@SeeminglyScience
Copy link
Collaborator

SeeminglyScience commented Jun 2, 2020

@PrzemyslawKlys if they did that they'd be back to square one. If a module imports other modules but does not export the commands then nothing is exported. If they do export the commands from the nested modules, they are back to exporting 4k commands in a single module.

@scrthq awesome! Thanks for the update 🙂

@PrzemyslawKlys
Copy link
Contributor Author

PrzemyslawKlys commented Jun 2, 2020

@SeeminglyScience the way Azure module does it is you have meta module that downloads other modules, which have exported commands? I would guess this doesn't impact performance at all? Meta module simply is there so if user asks for AWSPowerShell it gets downloaded all 200 modules with proper commands?

Edit. removed azure links as they seem to have changed something.

@scrthq
Copy link

scrthq commented Jun 2, 2020

To be fair, if AWSPowerShell just had the AWS.Tools.* as RequiredModules, the command help/intellisense would resolve to the service specific Tools module, so that wouldn't theoretically result in the same issue. Wouldn't be my place to ask any more than yours, @PrzemyslawKlys, as I don't work for AWS, unfortunately, just a large user of AWS at our org with plenty of AWSPowerShell usage.

@PrzemyslawKlys
Copy link
Contributor Author

You see that I don't get. If a module is a proper module with all cmdlet/functions/aliases described doesn't that mean ultimately any get-help/get-command doesn't need to do any heavy searching but has this widely available? So if you bundle 50 of those modules as a meta module which has a single purpose of being "download this modules which have proper psd1 file" purpose it would solve the issue no?

@SeeminglyScience
Copy link
Collaborator

It's explicitly importing all of it's nested modules into the global scope.

  1. This makes it impossible to be used as a nested module
  2. It doesn't inform the user about what it adds to the session
  3. In general makes interacting with the module itself work differently than every other module
  4. Doesn't actually do anything unless you explicitly import the meta module

It's not really something I'd ever recommend folks to do.

@PrzemyslawKlys
Copy link
Contributor Author

So let me get this straight:

  1. AWSPowerShell module exists and has 4k+ commands that are not defined in PSD1 and people continue using it, and it alone is a big performance impact
  2. AWS.Tools.xxx exists each with its own properly defined commands

Since AWSPowerShell, basically does now what 50+ properly modules does together, I would assume that if they create a meta module with required modules defined for all 50 modules it means that:

  1. All 50 modules get imported if you do Import-Module AWSPowerShell, but instead of it commands it imports 50 other modules with properly described commands.
  2. Since all those 50 modules exist and are properly defined the import for their data is not performance affected at all
  3. It's possible to not call AWSPowerShell but call whatever you need directly
  4. It solves performance issue for everyone currently using AWSPowerShell in Code

And I would guess if you put AWSPowerShell into RequiredModules of something else it will work too. Module X defines RequiredModules AWSPowerShell, AWSPowerShell defines AWS.Tools and nesting works as far as I remember up to 5. When you download module X it will auto download all other stuff, and I guess Import-Module of module X will properly work, as if the commands from AWS.Tools will be required those will be imported on demand?

What I am not understanding here? Keeping AWSPowerShell module as is, has huge impact that can be at least somewhat minimalized?

I'm not expecting AWSPowerShell to continue being used, but if someone does Import-Module AWSPowerShell it will work - I have similar meta modules for projects I have integrated into other modules and they do work, so not sure I understand what I did wrong or how this could be worse than what we have now?

@SeeminglyScience
Copy link
Collaborator

I gave some reasons why I don't personally recommend the practice in my comment above. That said, feel free to pitch it to the AWS team, they very well may disagree.

@GuruGarrett
Copy link

I just wanted to note that I went a few days without having any issues with the 5.1-CI.54138 build, and it looks like I just got updated to 6.0. I'm very hopeful all the issues that caused me so much frustration are now a thing of the past.

A huge thank you to @TylerLeonhardt @daxian-dbw @david-driscoll and anyone else who played a part in this fix that I missed! 👍

@TylerLeonhardt
Copy link
Member

Thank you all for your quick responses and helping us help you ❤️

@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Jun 4, 2020
@david-driscoll
Copy link

I'm just glad to hear things are working well without any issues! For a time there I thought I was going to have to back to the drawing board and just start from scratch. 😄

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 5, 2020
@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Jun 5, 2020
@ghost
Copy link

ghost commented Feb 16, 2022

Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests