adobe / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
33.25k stars 7.63k forks source link

Brackets hangs / slows down extremely on specific file #10646

Open joepie91 opened 9 years ago

joepie91 commented 9 years ago

While working on reproducing a Node.js performance bug that somebody was talking about, I asked for a test case and received one - however, upon loading the file into Brackets, Brackets will slow down extremely to the point that it'll only occasionally respond to a single click every 20 seconds or so. The application becomes effectively unusable. It does not seem to ever complete, and just uses a lot of CPU.

The file can be downloaded here. I have reloaded without extensions, and the issue persists.

Expected behaviour: File loads and is displayed, editor remains usable.

Actual behaviour: File loads and is displayed, editor 'hangs', only very occasionally responds to input, uses 100%+ CPU, and never completes. Need to kill -9 and restart.

Version:

Release 1.1 experimental build 1.1.0-15558 (release ea908cae5) 
build timestamp: Wed Dec 17 2014 13:00:52 GMT-0800

Operating system: openSUSE 13.1, Linux linux-etoq 3.11.10-25-desktop #1 SMP PREEMPT Wed Dec 17 17:57:03 UTC 2014 (8210f77) x86_64 x86_64 x86_64 GNU/Linux

Oddly, the testcase in question was related to extremely slow tracebacks in Node.js, but unless Brackets is somehow executing the files it loads, that shouldn't be related. Looks like we may have a polybug on our hands here :)

maxwowpow commented 9 years ago

I've noticed same behavior on windows with gulp config file, might something to do with "require's" inside of a file. However on windows it doesn't die. Seems with pre1.2 issue is partially solved, I still see 1 error in the console, but the files are being opened more quick.

nethip commented 9 years ago

@joepie91 @maxgrass Could you post the errors you are seeing in the debugger console, if any?

And also could you disable JS code hints and post your results. Please refer to the following link to work with preferences in Brackets.

https://github.com/adobe/brackets/wiki/How-to-Use-Brackets#preferences

codehint.JSHints is the setting that needs to set to false to disable JS code hints.

joepie91 commented 9 years ago

@nethip Nothing is printed to the debugger console after opening the file at all (when extensions are disabled). No errors, not even debug messages.

Turning off JS code hints fixes the problem, so presumably the problem is with the code hinting then?

nethip commented 9 years ago

@joepie91 Thanks for trying this out. Brackets uses tern library(https://github.com/marijnh/tern) for the JS code hints. This might be a bug with the tern. We could file a bug with tern, but we would require exact repro steps for that. I tried the demo located at (http://ternjs.net/doc/demo.html) with your source code and that seems to be working fine there. Maybe when this file is used in a project context the problem surfaces. Can you confirm?

joepie91 commented 9 years ago

I've copy-pasted the file into the tern demo, and it doesn't hang, so it doesn't appear to be reproducible there... Can you reproduce it locally in Brackets?

sarathipati commented 8 years ago

@joepie91 were you able to find a solution? I have a similar problem on opening a particular folder.