question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[3.1.0] Cannot create new tag for model after its been destroyed error during test teardown

See original GitHub issue

Beginning in Ember 3.1 we have a test that is failing on teardown with this error:

Assertion Failed: Cannot create a new tag for <model-b::ember2555:1> after it has been destroyed.

Working up a reproduction is going to be hard so I’ll do my best to describe the scenario:

There is a model A that has a belongsTo relationship with a model B.

Model A also has readOnly properties that depend on properties in model B a la isTrue: readOnly('modelB.someProp'). Where someProp on model B is an equal computed.

The above assertion seems to be getting triggered during teardown as ember-metal tries to unwatch each of the computed properties that depend on some property on the related model. As far as I can tell this does not occur while running the app.

I can make the error go away by either removing these computed properties (not really a solution) or setting the relationship to async: false.

I’m not sure if this is a regression per se, but I’m also not really sure how to best dig in and figure out how or where to fix this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
AlexMayantscommented, Jul 2, 2019

We have encountered the same error as @BryanCrotaz in 3.8.3. I used a modified version of his solution:

    unknownProperty(key) {
      if (this.isDestroying || this.isDestroyed) {
        return;
      }

      let content = this.content;

      if (!content || content.isDestroying || content.isDestroyed) {
        return;
      }

      return this._super(key);
    },

It seems to work, but this should probably be fixed within the Ember core.

1reaction
BryanCrotazcommented, Jun 9, 2019

I’m seeing this in ember 3.8.3.

With @rwjblue 's unknownProperty fix it is intermittent but still happens about 1 in 5 runs.

I built an instance initializer:

import ObjectProxy from '@ember/object/proxy';

export function initialize(/* appInstance */) {
  ObjectProxy.reopen({
    unknownProperty(key) {
      if (this.isDestroying || this.isDestroyed) {
        return;
      }
      return this._super(key);
    },

    willWatchProperty(/*key*/) {
      if (this.isDestroying || this.isDestroyed ||
        this.content != null && 
        (this.content.isDestroying || this.content.isDestroyed)) {
        return;
      }
      return this._super(arguments);
    }
  });
}

export default {
  initialize
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught Error: Assertion Failed: calling set on destroyed object
After all tests passed it returns extra two test with errors. Uncaught Error: Assertion Failed: calling set on destroyed object Source : '../dist/assets/vendor....
Read more >
Vue 3.1 - Official Migration Build from Vue 2 to 3 - This Dot Labs
If you were to upgrade without the migration build, your app would crash on the first error, leading to a very frustrating experience....
Read more >
Admin Manual - HelpSpot Support
Enter the credentials provided back in your HelpSpot mailbox setup screen. Set any other options as desired and then select "Add Mailbox" at...
Read more >
Documentation - Apache Kafka
In Kafka the communication between the clients and the servers is done with a simple, high-performance, language agnostic TCP protocol.
Read more >
Known issues - PaperCut
When a user clicks "Change user" in the Print Deploy client and logs in with a different username, print jobs sent to Mobility...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found