-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Bug] Memory Leak of routeRecognizer states in acceptance tests #19773
Comments
Thinking of a potential fix that looks like adding a
and calling this method in
The fix proposed here is similar to what @hmajoros proposed in #19684 |
Adding some info shared by @krisselden:
|
@step2yeung / @krisselden / @rwjblue - any update on the solution for this? |
I believe this may be resolved by #20025; I'll report on the results of my testing of that later today! Later: Unfortunately, I have confirmed that #20025 does not resolve this. It seems to be an unrelated leak. 😩 I should elaborate: on reflection, it's impossible that the thing we hit in #20025 could have fixed it; that bug was introduced after 3.24. |
A bit of follow-on info: I did some investigation on this today and found that this leak is very old. I chased it back to the version of SuperRentals running Ember 3.3 before I quit chasing, and I suspect it goes much further back than that. @rwjblue and @chadhietala and I all spent some time looking at the actual flow and debugging and found a set of particularly quirky things (using
We aren't yet sure why this is the case—especially for the first instance. We'll keep digging as we have time. Footnotes
|
🐞 Describe the Bug
In acceptance tests on ember 3.24 (and latest), routeRecognizer instances are being retained by EmberRouter: (Heap snapshot from super rentals tests, of the states from routeRecognizer being retained)

Once an instance of the routeRecognizer is retained, the number of State in the states array adds up quickly in large apps, causing the browser to crash due to OOM. (In our large ember app, a single routeRecognizer instance stores ~60,000 states)
🔬 Minimal Reproduction
Running an app using ember 3.24+, create an acceptance test.
Using Chrome's Memory tab, run the test and capture a heap dump
Inspect the heap dump for 'State' constructors, notice instances of routeRecognizer class
😕 Actual Behavior
_routerMicrolib is hanging on to references states from routeRecognizer.
🤔 Expected Behavior
References to routeRecognizer should be cleaned up in between tests.
🌍 Environment
Ember: 3.24.4 or higher
Node.js/npm: v14.15.1
OS: Mac
Browser: Chrome
➕ Additional Context
N/A
The text was updated successfully, but these errors were encountered: