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

invalidateSession "broken" in latest release version of ember. #593

Closed
cibernox opened this issue Jul 27, 2015 · 3 comments
Closed

invalidateSession "broken" in latest release version of ember. #593

cibernox opened this issue Jul 27, 2015 · 3 comments

Comments

@cibernox
Copy link
Contributor

Coming from here: emberjs/ember.js#11864 (comment)

tl; dr;

The latest version of ember stable (not yet tagged but already available using components/ember#release and will be released in 1.13.6) includes a bugfix in some memory leaks.

One of the fixes consists in unregister test helpers when the app is destroyed. However this causes an error in invalidateSession when you have an afterEach hook like this:

  afterEach: function() {
    invalidateSession();
    Ember.run(application, 'destroy');
  }

It turns out that invalidateSession is asynchronous (BTW, why?) the destruction of the app is synchronous because happens inside an Ember.run, so by the time the session is invalidated the wait() helper is not available anymore.

Doing Ember.run(invalidateSession); worked for me, although @stefanpenner suggested to chain the invalidation of the session like this:

invalidateSession().then(() => Ember.run(application, 'destroy'))

It's a bit verbose but I'm ok with it if it has to be done that way, as long as it's explained in the documentation.

I'd also like to know why the invalidation of the session is async, because perhaps the helper can be run-loop aware and allow to keep being used without chaining.

@marcoow
Copy link
Member

marcoow commented Jul 27, 2015

invalidateSession asynchronous because the underlying authenticator implementation might be asynchronous. When you're using the ephemeral session store you shouldn't need the invalidateSession call at all though as every time the application restarts you'll have a new session with a clean store.

@cibernox
Copy link
Contributor Author

I don't remember why I added this, but I remember some tests failing without it. I'll investigate it.

@marcoow
Copy link
Member

marcoow commented Oct 16, 2015

closing - please reopen if the problem persists

@marcoow marcoow closed this as completed Oct 16, 2015
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

2 participants