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

Chrome freezes tab with Ember Inspector extension #690

Closed
ghost opened this issue Jul 21, 2017 · 18 comments
Closed

Chrome freezes tab with Ember Inspector extension #690

ghost opened this issue Jul 21, 2017 · 18 comments
Assignees

Comments

@ghost
Copy link

ghost commented Jul 21, 2017

Hello,

I'm using latest Chrome and Ember Inspector extension. The problem is, when you enable Ember Inspector extension and you go to the Data and use unloadRecord() for e.g. I have Delete button which unloads record after delete and when I press it Chrome tab will freeze and uses a lot of memory and CPU. When I turn off ember extension everything works fine with developer tools opened, but with ember inspector extension I get this. Nothing helped, I even cleaned cache, settings and so on.

If you don't open Developer Tools with Ember - everything is OK.
If you open Developer Tools for e.g. with Console tab - everything is OK.
If you open Developer Tools with Ember - everything is OK.
If you open Developer Tools with Ember and you go the Data - chrome tab freezes and uses a lot of resources.

@ghost
Copy link
Author

ghost commented Jul 21, 2017

Seems it also freezes if extension is just enabled, but you're not in Data with Ember Inspector. But to reproduce it 100% you need go to the Data.

@ewjoachim
Copy link

ewjoachim commented Jul 30, 2017

I have no idea if it's linked, but I have another case of Chrome + Firefox freezing + using 100% of CPU when selecting a specific model on the Data panel... Details and a minimum reproduction setup are here (well, as minimum as I could make that). See the readme for all the details.

@ewjoachim
Copy link

For what it's worth, it seems other people have been posting messages on Slack related to problems that look similar :

https://embercommunity.slack.com/archives/C04ENQPFW/p1501207850719655

nlincoln wrote:
I just upgraded ember-data from 2.14.4 to 2.14.7 today and now when I try to view models inside of the data part of the inspector chrome just starts eating memory, the page becomes completely unresponsive and I have to kill both the page and the chrome devtools via the chrome task manager to get things to work again

@ewjoachim
Copy link

For me the problem is not visible with ember-data 2.13.2 and is there with 2.14.x, whatever the x (up until 7).

@stephanebruckert
Copy link

stephanebruckert commented Aug 4, 2017

Same here, happens only when the data tab of the ember inspector is open. In my case it's caused by destroyRecord() which probably clears the data the same way as unloadRecord() (used by OP) does.

self.get('store').find('token', tokenId).then(function(a) {
    a.destroyRecord()
})

100% of the CPU is used, the memory keeps increasing and nothing is showed in the console

screen shot 2017-08-04 at 16 36 52

✗ ember -v
ember-cli: 2.13.1
node: 7.9.0
os: darwin x64

Ember Inspector 2.0.6
Chrome Version 60.0.3112.90 (Official Build) (64-bit)

Initially thought something was wrong in my code and took me a long time to figure it wasn't the case, as I always keep the data tab open! 😅

@ghost
Copy link
Author

ghost commented Aug 4, 2017

@stephanebruckert Everything is same for me. Even the last sentence 😄 It's just impossible to work with Ember Inspector, but I really need it to see the routes, data and so on.

@kernel-io
Copy link

Also happening to me, luckily it did not take me long to figure out it wasn't my fault considering it is a new project 😄

@stephanebruckert
Copy link

stephanebruckert commented Aug 7, 2017

I wrote my destroyRecord a bit differently and the issue is not happening anymore:

// hack https://github.com/emberjs/data/issues/4972#issuecomment-312301105
this.get('store')._removeFromIdMap(this.get('model.calendarToken')._internalModel);
this.get('model.calendarToken').destroyRecord();

according to emberjs/data#4972 (comment)

@IAmJulianAcosta
Copy link

Check that your data is loading fine, had an issue with it in the last month, and it was caused by malformed/corrupt data, that freezes data tab. I had to comment the queries until I found the model that was causing the problem. YMMV

@ewjoachim
Copy link

No kind of malformed data should silently bug and crash your tab, without even a single error message...

@IAmJulianAcosta
Copy link

I agree, but that probably will unlock other people with the same problem while is fixed :)

@sammynave
Copy link

If this helps anyone, here's a project and steps to repro the issue: https://github.com/sammynave/freeze

@urbany
Copy link

urbany commented Aug 11, 2017

Got hit by this today, on [email protected] seems to happen when I delete an unsaved record

@tomgazit
Copy link

experiencing the same issue....

@elke1979
Copy link

I use Chrome (Version 60.0.3112.90 (Official Build) (64-bit)) + the latest Ember Inspector extension.
If I log into https://www.emberjs.com/api/ember/2.14/namespaces/Ember (Ember API website) and I browse the Ember Inspector the browser freezes when I click "Data".

@pomm0
Copy link

pomm0 commented Aug 22, 2017

have the same problem, any news? :(
It freezes firefox too

@teddyzeenny teddyzeenny self-assigned this Aug 26, 2017
@teddyzeenny
Copy link
Contributor

Thank you all for the detailed bug report. I was able to reproduce it and I'm investigating the issue.

teddyzeenny added a commit to emberjs/ember.js that referenced this issue Aug 27, 2017
… count actually changed

Fixes emberjs/ember-inspector#690

The issue:

In some cases, Ember Data's `peekAll` triggers `arrayContentDidChange` on the record array manager's live record array even if the records didn't change.
One example case is when we call `unloadRecord` and then `peekAll` within the same run loop.
The `peekAll` will trigger the array observer's `didChange` callback (with zero changes).
This is generally harmless as long as we guard against that in our data adapter.
Without the guard, we risk causing an infinite recursion because our `didChange` observer itself calls `peekAll`, which in the above scenario will re-trigger
the observer and so on.
@teddyzeenny
Copy link
Contributor

I identified the issue and proposed a solution emberjs/ember.js#15604.
The downside is that this is not a bug in the inspector itself, which means you'll need to upgrade your Ember version to get the fix.

rwjblue pushed a commit to emberjs/ember.js that referenced this issue Oct 4, 2017
… count actually changed

Fixes emberjs/ember-inspector#690

The issue:

In some cases, Ember Data's `peekAll` triggers `arrayContentDidChange` on the record array manager's live record array even if the records didn't change.
One example case is when we call `unloadRecord` and then `peekAll` within the same run loop.
The `peekAll` will trigger the array observer's `didChange` callback (with zero changes).
This is generally harmless as long as we guard against that in our data adapter.
Without the guard, we risk causing an infinite recursion because our `didChange` observer itself calls `peekAll`, which in the above scenario will re-trigger
the observer and so on.

(cherry picked from commit 7bd47da)
rwjblue pushed a commit to emberjs/ember.js that referenced this issue Oct 4, 2017
… count actually changed

Fixes emberjs/ember-inspector#690

The issue:

In some cases, Ember Data's `peekAll` triggers `arrayContentDidChange` on the record array manager's live record array even if the records didn't change.
One example case is when we call `unloadRecord` and then `peekAll` within the same run loop.
The `peekAll` will trigger the array observer's `didChange` callback (with zero changes).
This is generally harmless as long as we guard against that in our data adapter.
Without the guard, we risk causing an infinite recursion because our `didChange` observer itself calls `peekAll`, which in the above scenario will re-trigger
the observer and so on.

(cherry picked from commit 7bd47da)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants