-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Tests instantiating models with relationships fail on ember-canary
#5465
Comments
noise when a container is leaked. Add asserts if lookup and factoryFor are called after destroy.
Probably a bit of both. 😆 The goal of the assertion is to ensure that a destroyed container (which has released all of its instances and whatnot for GC) does not have additional lookup methods called on it (which would now leak memory because there is no way to run destroy again). Depending on how hard this is to fix in ember-data we could change the upstream assertion into a warning or a private API deprecation slated for 3.5 removal, but either way the underlying issue reported here (doing owner.lookup or owner.factoryFor after destruction) should be addressed. Thank you for reporting! |
I'm finding this happens in routes where I call |
I'm also seeing this happening when records are destroyed during teardown and it attempts to access the inverse meta. |
Fixed in emberjs/ember.js#16754 |
I just reproduce the problem on ember 3.3.1 with a generated model when I add a relationship. The generated test fails with the same error EDIT: I rollback on ember 3.1 for now |
I found this issue from Google. I'm running into this in an addon I'm writing tests for. In my Ember try scenarios I have no container leak when using with Ember 3.1 and Ember Data 3.1. However, In Ember 3.4 with Ember Data 3.4 this assertion pops up and there is a The container leak/assertion failure only happens when I try to access Ember Data. For example, the failure happens when testing a route that calls Right now my travis builds are failing for 3.4 (ember-release + data release) and I'm a little suck on how to get them working. I'm unsure how to proceed or what I should be doing in this situation. |
@ryanto I think the issues you want are #5554 and emberjs/ember.js#16860 |
Cool! I'll give those a read. Also, I was getting hardcore trolled by npm dependencies earlier today. I think what I originally posted was incorrect and the result of bad dependency resolution. My final build was ending up with Ember 3.4 + ED 2.18... which causes that assertion error. So if anyone comes across this error, double check that you're not using a data 2.x with Ember 3.4! |
Here is an addon demonstrating the issue. It's just a vanilla addon with
ember-data
installed and a couple of models generated,user
whichbelongsTo
organization
.If you run
ember try:one ember-canary
(as of the filing time of this issue), it will fail because it hits this newly-added assertion:This is happening because when the store is unloading the
organization
record (resulting from tearing down the test context), it looks at its relationships, which ultimately results in amodelFor
call to look up theuser
model at the other end of the relationship, which looks it up in the container, which is already destroyed. It looks like this has been happening for a long time, but is just now failing because of the newly-added assertion. I'm not sure ifember-data
's behavior is incorrect, or if the assertion is overly aggressive.The text was updated successfully, but these errors were encountered: