-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Tern freezes Brackets for certain JS libraries #3977
Comments
@caiotoon Sorry to hear you're having problems with Sprint 25. This is the first we've heard of this problem, so please try to remember what you did right before it happens again to help us find a pattern. Also, try clearing your cache (https://github.com/adobe/brackets/wiki/Cache-Folder). Maybe some data from previous sprint is causing a problem. Let us know if you have any more info! |
Also, do you have Chrome installed? If so, when this happens, try going to http://localhost:9234 in Chrome. |
@njx just happened again. http://localhost:9234 shows only the title "Inspectable WebContents", no other content. The Here is a print screen: @redmunds as I said, there is no pattern. Sometimes it happens on alt+tab, sometimes when I'm typing, others just after saving. I haven't tried cleaning cache yet. Will after testing @njx ideas. |
Just an additional info, I currently have both Sprint 24 and 25 installed, as 25 is not working. Does the URL in Chrome remains the same? |
It's looking like this might be a memory leak. We're looking into it. Thanks for the info! |
Couple of more questions: |
Hey guys, just a little bit more of info. I also hit this yesterday on sprint 24 (786bb99). For what it's worth, I was messing around with the CodeMIrror project, and Brackets was freezing on You may try to reproduce it with that one. I'll try to see if I can get more info later today. |
@njx I used it for a while right now (without code hint) and the problem didn't happen. I was quit and reopening Brackets, but didn't hit F5. I'll continue using until the end of the day and post back the result. |
@caiotoon Thanks for looking into this. In your project, how many of the files would you say are JS files? |
Also, are you using any frameworks (e.g. ember, angular, ...)? |
I ran into the blank screen issue a couple times this morning. I can reproduce with these steps:
BOOM - blank screen. |
@jbalsas Were you editing CodeMirror in the context of Brackets (i.e., did you have the brackets folder open as the project root, or just the CodeMirror folder)? |
I've isolated the reload crash and put up a pull request to fix it: The pull request only fixes the reload case. Other cases like clicking in the editor, Alt+Tab, etc. are not addressed. |
@njx Just the CodeMirror folder (not the one inside Brackets though, just a fork of it). It looks like the issue is with the What I do is:
Quite soon, a noticeable delay presents when invoking the code hints. After a certain while (1 or 2 minutes) code hints don't appear anymore, and around 3 or 4 minutes Brackets freezes. At this moment, I can't see the I've also profiled in Chrome, and although memory does seem to grow on every codehints invocation, it looks like it's garbage collected properly and stays below 30Mb. Also, when Brackets freezes, nothing shows on Chrome dev tools (Elements panel shows empty). Hope this helps tracking this down. |
@jbalsas Great! (Well, not great :)) I can repro with your steps, though I have to open and close code hints a bunch. One thing we noticed is that while the memory usage is climbing up (and especially after the code hints stop working), the Brackets Helper process is pegged at 100% CPU. So it does seem like the worker is getting hosed. |
This is very similar to the problem I was hitting with codehints on Angular.js. I was getting the exact same kind of crash. The problem ended up being in Tern. |
Yup, that one got fixed, but this seems to be a different case. Could be a similar underlying cause that didn't happen to get fixed. |
Not sure if it's still helpful, but the problem didn't happen while js hint was disabled. Also, I'd say the project have 150~200 script files. I use AngularJS, jQuery and some other libraries. Hope this help. |
@eztierney reports that this fix to Tern.JS might resolve the issue: ternjs/tern@bf369cc |
I also run into this issue when I use my tern hinting extension. This only happens with large code bases. I debugged it once for a bit and I noticed that sending hinting requests triggered by document changes to tern while already waiting for a hint request was slowing down tern quite a bit. Eventually hints don't come up and the screen goes blank. Marijn reduced reduceMaxWorkDepth and that seemed to have helped a lot. |
Great effort from all contributors to track this down quickly. Made this a high priority issue and assigned @eztierney . @njx should we integrate tern with the fix from marijnh - its 2 commits away from what we currently integrated? |
Submitted a pull request to update tern - it doesn't totally fix the problem, but it does slow down the memory growth. |
@MiguelCastillo thats interesting - just this morning I saw tern do something similar, and I was making more hint requests before the previous ones had finished. I haven't been able to reproduce it, but maybe there is some lurking bug there... |
@eztierney I am thinking that coming up with a way to queue hint requests when editing the document might be a good idea. I can reproduce the problem when typing quickly. I also have lots of requirejs dependencies, so I am not sure if tern has to do something special. I havent had much time to figure out what's really happening but maybe this long weekend I can. |
@caiotoon @jbalsas @MiguelCastillo and anyone else who has run into this issue: we just pushed changes to master that significantly decrease memory usage with code hints. Could you pull the latest code and see if you can still reproduce the problem? Thanks! |
@MiguelCastillo thanks for the info - I tried reseting the ternInstance.files, which we weren't doing, but it did not seem to help the memory problems in this case. So far the only thing I have found that works is terminating the worker thread we run tern in, which is less than ideal, but at least it works. |
Still hitting this occasionally, but it can take up to an hour to happen. |
I have a case where I can freeze Brackets first try, almost every time: I did a QuickEdit search that brought up an inline editor window. With that window still open, I clicked Debug->Show Performance Data. Performance data came up and Brackets was dead. Not the same case others are reporting, but dead frozen. This is also reproducible with Sprint 24. |
@jeffkenton Please open a new issue for that case. Thanks. Done: Issue #4121 (jeffkenton) |
@eztierney @pfarland - I'm moving this out into the next sprint. I believe the current state is that we have a short term fix. I'm not clear if there are better ways to architect around the issue or if we perceive it as a FOL. Lets meet and talk about the options we have moving forward. Thanks, |
Bumping the priority down to medium since most people are no longer running into this issue. If anyone has reproducible steps with the current build, please add them here. |
I downloaded sprint 27 today and it freezes (like described above) as soon as I open my project folder ... sprint 26 was at least working for a few minutes for me. I tried clearing the cache and also deleting all the extensions / reinstalling but nothing helped. |
@zaggino - that sounds bad, and possibly different from what we've noticed before, if it literally happens as soon as you open the folder (is there any delay between when you open the folder and when it freezes?). What OS are you on? Can you look at Task Manager (Win) / Activity Monitory (Mac) and see if the Brackets or Brackets Helper process is using a lot of memory? |
This is 100% related to a large project in currently opened folder as when switch to another folder and try to open my files, everything works fine. Project itself includes many libraries like jquery, bootstrap, and so on and also includes a lot of own javascript code ... about 150 files. |
@zaggino When we've seen this before it's usually been caused by 1 particular version of a library file (bootstrap, angular, ember, etc). The trick is figuring out which one is the problem. You can either try removing the library files, or with Sprint 27 we added a configuration file for code hints that you can use to exclude certain files, or directories. You can create a file named .jscodehints and put it in the directory you are opening with brackets. The file should look something like: {
"excluded-directories" : ["/lib"],
"excluded-files" : ["file1.js", "file2.js"]
} That would exclude all the files in the lib directory, and any files named file1.js or file2.js. You could use that to try to narrow down which file it is, and to work around the problem and still get codehints for the rest of your code. Alternatively, if the project is public and you could point us to it, we could take a look at it and try to narrow it down. |
@eztierney Great feature indeed. I tried excluding just node_modules directory and everything seems stable for now (it includes latest async, express, mongodb, q, underscore). Strange enough - when I cancelled the directory exclusion so I can pinpoint exact library it's still working. I will definitely play with it and see if I can pinpoint particular library that's causing problems. Reading the sources of brackets I suppose I can just use max-file-size: 1 to turn off hints completely when the problems will return but hopefully they won't. |
How the temp folder works ? I managed to lock out brackets that it didn't even start properly after taskkill-ing it so I tried removing everything in cache folder (\AppData\Roaming\Brackets\cef_data) but it didn't help. Then I restarted the entire Windows and it's working again ... Are brackets saving temp data somewhere else too? |
@cfjedimaster reported on the Google Group that the Parse library also seems to cause the Tern crash. https://groups.google.com/d/msg/brackets-dev/LdHhNFs_m-k/vjsxUdDxpecJ |
I can reproduce it consistently on my Windows 7 with ExtJS. And I also narrow it down to only two files from ExtJS -- ext.js and ext-debug.js. If you have one of them in your project folder, then you don't see the issue, but if you have both of them, then you can get Brackets frozen in a minute. You can watch the memory consumption in Processes tab of Task Manager. And the same two files have no issue with sprint 26. Update 1: I can reproduce it on Mac with the same two files. Replacing the entire thirdparty folder under extensions\default\JavaScriptCodeHints\ with the one from sprint 26 does fix the issue. Update 2: I confirmed that this issue is introduced with this commit in Tern ternjs/tern@2010f93. Update 3: Others are experiencing the same memory issue and has logged this Tern issue ternjs/tern#185. |
I just tried the Parse library in a fresh project. In that environment, it does not fail. As @RaymondLim notes, the problem may be with certain combinations of files. Raymond also narrowed the problem down to a specific commit in Tern |
Further note about Parse. I've tried the combination of Parse+jQuery as noted on the mailing list and have seen no problems yet. |
Another update: I have filed a new Tern issue on the Ext case that @RaymondLim identified. I have managed to cut the vast majority of the code out of the Ext files and still reproduce the issue. I'm not sure that the failure there is a general case. |
Hi folks--we've made some progress on the various Tern issues. We have fixes for a number of them, but we're still tracking a specific crash in #4400 that appears to be a bug in Chromium. For now, we'll close this bug. If you continue to run into issues in the next sprint (Sprint 28), please file a new bug with details. Thanks. |
Thanks, guys. |
It is 2 years later and I am still having this issue |
For what it's worth: I've recently installed Brackets 1.3. It worked fine, though admittedly I did not do a great deal with it yet. Tonight when I ran it again, it notified me of a new version, 1.4. Since installing it, hitting F5 with a trivial page is consistently locking up Brackets as per the first post in this thread (white screen, requires task manager to kill.) |
After updating to Sprint 25, my Brackets is constantly freezing. It's not like a Windows freeze, the windows simply become empty (no left panel, no menu and no content).
When its frozen, I can move the window and click minimize and close button, but Brackets doesn't close. I have to kill the process.
The problem occurred while editing code, on ALT+Tab, when not using it... seem to have no pattern.
Windows 7
Brackets Sprint 25
No extensions installed
The text was updated successfully, but these errors were encountered: