Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Code hints: CPU stays at 100% with specific project, may eventually crash #7245

Description

@peterflynn

This code is derived from the following project: https://github.com/etrepum/platformer-melon-js -- if you clone that and do a grunt build, you'll also hit the bug. The testcase here is simplified.

  1. Download the files from https://gist.github.com/peterflynn/9635216 and place them all in one folder
  2. Open the folder in Brackets
  3. Open melonJS-0.9.11.js

Result:
One CPU core goes to 100%, and Brackets memory usage climbs continuously. (Sometimes it seems to level off around 800-900 MB even though CPU remains at 100% afterward; other times memory usage keeps climbing until it crashes).

If any one of the 4 files is removed, Brackets tops out at about 400 MB of memory usage and CPU returns to normal afterward.

Activity

  1. peterflynn commented on Mar 19, 2014

    @peterflynn
    MemberAuthor

    If I delete roughly the bottom half of melonJS-0.9.11.js (from line 8571), memory usage levels off at around 740 MB and the CPU returns to normal... so maybe this really is simply too much code to handle, and not an infinite loop of any kind (the seemingly much-longer freeze with only slightly more code could be due to GC thrashing).

    Are we filtering out large files from Tern? It seems like anything over 100-200 KB is a safe bet that it's a minified library or build artifact that should be ignored...

  2. peterflynn commented on Mar 19, 2014

    @peterflynn
    MemberAuthor

    ...and deleting the bottom half of app.js (from line 9731) gets it to level off at ~840 MB

  3. Qantas94Heavy commented on Mar 19, 2014

    @Qantas94Heavy

    According to https://github.com/adobe/brackets/wiki/JavaScript-Code-Hints:

    • max-file-size
      Files larger than this number of bytes will not be parsed. The default value is 524,288 bytes (512KB).

    This is probably a conservative value, feel free to change it yourself in a .jscodehints file in the project root if your project doesn't contain any other files over your limit for code hints.

  4. self-assigned this
    on Mar 19, 2014
  5. dangoor commented on Mar 19, 2014

    @dangoor
    Contributor

    @peterflynn I'm pretty sure it's not just a matter of it being "too much code to handle". These cases seem to often be edge cases for Tern's inference. This is probably not a narrow enough case for Marijn to troubleshoot, though. Minified files aren't so good for code completion anyhow.

    I wonder if there's a way that we could detect a case like this, prompt the user and then save a file exclusion?

  6. added this to the milestone on Mar 21, 2014
  7. peterflynn commented on Mar 21, 2014

    @peterflynn
    MemberAuthor

    Nominating for 1.0 -- I'm not of the view that Brackets has to magically just work in project with 200 MB of JS code, or 100,000 files, etc., but (a) this project wasn't really that big, and (b) we should fail a little more elegantly than just crashing.

    (Same goes for #7262 - not sure whether to dupe that to something else yet or not)

  8. changed the title [-]Code hints: CPU stays at 100% with specific project[/-] [+]Code hints: CPU stays at 100% with specific project, may eventually crash[/+] on May 2, 2014
  9. redmunds commented on Jun 12, 2014

    @redmunds
    Contributor

    @peterflynn @dangoor Is anyone still seeing this one? Using Peter Flynn's gist the cpu barely moves on Mac 10.8. On Win7, cpu maxes out for ~30 sec, then it goes back to normal.

    UPDATE: OK, I'm seeing same behavior on Mac as Win now. Brackets UI is functional and responsive during this time, so it doesn't seem bad.

  10. dangoor commented on Jun 13, 2014

    @dangoor
    Contributor

    @redmunds This is the kind of case for which the new timeout in Tern should be handy. Marijn would like reproducible cases, but to stop the pain today just being able to disable hints for problematic files will help.

  11. dangoor commented on Aug 13, 2014

    @dangoor
    Contributor

    This issue is fixed in master (you get a popup warning you about problem files and exclusions are automatically added for those files). I was able to successfully get hints for app.js, though it's possible that even that file will fail for some people because it's so large.

    Note that I just filed #8750 because it appeared that I needed to reopen the project after the exclusions were added in order for hinting to work.

    FBNC to @peterflynn

  12. redmunds commented on Oct 2, 2014

    @redmunds
    Contributor

    This was fixed in 0.43 so changed Milestone.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions