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

"Extension causes high cpu load" warnings from VS Code due to slow module loading #1628

Closed
TUKenStone opened this issue Apr 18, 2019 · 6 comments
Milestone

Comments

@TUKenStone
Copy link

  • Issue Type: Performance
  • Extension Name: dart-code
  • Extension Version: 2.25.1
  • OS Version: Darwin x64 18.5.0
  • VSCode version: 1.33.1

⚠️ Make sure to attach this file from your home-directory:
⚠️/Users/ken/Dart-Code.dart-code-unresponsive.cpuprofile.txt

Find more details here: https://github.com/Microsoft/vscode/wiki/Explain:-extension-causes-high-cpu-load

@DanTup
Copy link
Member

DanTup commented Apr 18, 2019

@TUKenStone are you able to attach the file mentioned in your message?

⚠️ Make sure to attach this file from your home-directory:
⚠️/Users/ken/Dart-Code.dart-code-unresponsive.cpuprofile.txt

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label Apr 18, 2019
@TUKenStone
Copy link
Author

TUKenStone commented Apr 18, 2019

I’m not even sure what I need to attach to my home directory even mean since it’s already attached to /Users/Ken or ~/ which is my home directory but nowhere else.

Note:
This was an auto generated issue posted to GitHub by VS Code upon receipt of “Error connecting to the service protocol: HttpException: , uri = http://127.0.0.1:1027/ws.” I’ve exhausted my option trying to fix this error going for almost a day now as follows:

  1. Python -c “import weakref”
  2. Network Link Conditioner”
  3. macOS Restart
  4. etc and still error prone...

@DanTup
Copy link
Member

DanTup commented Apr 18, 2019

I’m not even sure what I need to attach to

@TUKenStone sorry, what I mean was there is a file at /Users/ken/Dart-Code.dart-code-unresponsive.cpuprofile.txt that VS Code created when it gave you this warning, and you are supposed to attach it to this GitHub issue. It's a CPU profile of the extension code, which will show what code was running when this happened.

Unfortunately I can't reproduce this issue (though my machine is very fast). I've had a few people raise it in the past, but none have ever attached the CPU profile, so I've never been able to investigate where the time is going.

If you can attach that file (which I believe VS Code has sanitized to ensure there is no personally identifiable info, pathnames, etc.) I can investigate. If you'd rather share it privately, you can email it to logs@dartcode.org.

Thanks!

@DanTup
Copy link
Member

DanTup commented Apr 18, 2019

@TUKenStone Thanks! I got the trace, and it looks like the cause is that the extension has lots of files, and the loading and compiling of each is slow (this explains VS Code's push to have extensions bundle their JS recently).

I don't think this is related to the other issue you mentioned though ("Error connecting to the service protocol: HttpException: , uri = http://127.0.0.1:1027/ws"). Can you open another issue about that? We might need to move it to the Flutter repo, but we can do a little debugging first to get more info.

@DanTup DanTup changed the title Extension causes high cpu load "Extension causes high cpu load" warnings from VS Code due to slow module loading Apr 18, 2019
@DanTup
Copy link
Member

DanTup commented Apr 18, 2019

I can repro this now - not the warning, but the poor performance at least. It seems to be related to loading dart_debug_protocol.ts and all its descendant require()s. There are calls to things like Module._resolveFilename which take > 250ms (because it goes and reads the JSON for the package). No wonder VS Code wants all the modules bundled. Looks like this will need to be revisited...

Screenshot 2019-04-18 at 9 53 55 am

@DanTup
Copy link
Member

DanTup commented Jun 6, 2019

Fixed by #1741.

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

2 participants