Skip to content

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

Closed

Description

@TUKenStone
  • 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

Activity

  1. DanTup commented on Apr 18, 2019

    @DanTup
    Member

    @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

  2. added
    awaiting infoRequires more information from the customer to progress
    on Apr 18, 2019
  3. TUKenStone commented on Apr 18, 2019

    @TUKenStone
    Author

    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...
  4. DanTup commented on Apr 18, 2019

    @DanTup
    Member

    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 [email protected].

    Thanks!

  5. DanTup commented on Apr 18, 2019

    @DanTup
    Member

    @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.

  6. changed the title [-]Extension causes high cpu load[/-] [+]"Extension causes high cpu load" warnings from VS Code due to slow module loading[/+] on Apr 18, 2019
  7. DanTup commented on Apr 18, 2019

    @DanTup
    Member

    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

  8. added and removed
    awaiting infoRequires more information from the customer to progress
    on Apr 18, 2019
  9. added this to the On Deck milestone on Apr 18, 2019
  10. modified the milestones: On Deck, v3.2.0 on May 23, 2019
  11. DanTup commented on Jun 6, 2019

    @DanTup
    Member

    Fixed by #1741.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions