-
Notifications
You must be signed in to change notification settings - Fork 929
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
Unit test memory leak #4836
Comments
This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information. |
Thanks for reporting this with a clear repro! We will investigate. |
On linux I get a consistent 56-166MB heap size when restarting node, nothing interesting. When using the jest re-run command the heap allocation starts to climb. This seems like a problem with Jest and not with the emulators I looked into this for some time - it seems that Jest has a serious memory leak problem and there's no easy solution, see this issue open since 2019: Some have suggested downgrading to Node 16.10 to mitigate the issue. I'm not a Jest expert, but I spent some time following this heap dump debugging pathway: https://chanind.github.io/javascript/2019/10/12/jest-tests-memory-leak.html I wasn't able to find a conclusive culprit - it may be within Jest. It LOOKS like the heap is filling up with strings (44MB and 62% heap allocation is in strings). At any rate I don't think this is an issue we can/should solve within Firebase. Feel free to let me know if you disagree but I'm closing this one out for now. |
[REQUIRED] Environment info
firebase-tools:
11.4.2
node --version:
v16.16.0
Platform:
MacOS Monterey 12.5, MacBook Pro Apple M1 Max, 64 GB
[REQUIRED] Test case
Repro: https://github.com/vojdan/firebase-memory-leak
Look at Issue 2 in README.md
https://github.com/vojdan/firebase-memory-leak#issue-2---memory-leak
[REQUIRED] Steps to reproduce
GIF included in README
https://github.com/vojdan/firebase-memory-leak#issue-2---memory-leak
Start firebase emulators (in terminal 1)
npm run emulators:test
Run tests in watch mode (in terminal 2)
npm run test:memleak
[REQUIRED] Expected behavior
Heap memory will stay low. Note: memory stays low when running
npm run test:watch
[REQUIRED] Actual behavior
Heap memory increases on every re-run and eventually crashes. Press
Enter
interminal 2
after test run finishes to re-run.The text was updated successfully, but these errors were encountered: