-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Jest is leaking memory even on a simple default redwood app #4208
Comments
If possible, can you try pinning the Node.js version to 16.10? There seems to be a memory usage issue with Jest on the Node version higher than 16.10. More details here: jestjs/jest#11956 |
@callingmedic911 don't see any difference, in fact it is arguably worse: |
Hi all! Some updates here based on my evaluation of #4024, which will be included in the imminent release. (Full related comment here.) Here's the relevant results of a simple performance test comparing v0.41 (latest) with recent canary (next).
Performance ResultsI used my standard https://github.com/thedavidprice/redwood-tutorial-test repo. v0.41.0
v0.41.1-canary.162 (latest)
We see both time and heap improvements for Web tests, as intended with this PR! Even more important (and unexpected) is that we see a massive improvement to heap when running both via |
FYI @thedavidprice I noticed that v0.42.0 went out, so quickly updated with Something's broke, but don't have time to investigate right this second: |
Thanks @zygopleural That should have been a seemless update. Appreciate you reporting this.
Looping in @dac09 @callingmedic911 Any thoughts about next steps here to diagnose? Possible it's related to #4024? |
Hey folks, can you confirm you weren't seeing this prior to 0.42? We diagnosed this heap usage issue present in all the previous versions, and from our tests .42 seemed to improve it. The issue seems to be related to jest and node, so I'd be surprised if this is a new one. Any details of the errors would be appreciated, can't really diagnose from the screen shot ✌🏽 @callingmedic911 and I have definitely seen usage drop switching to node 16.10 (as recommended in the issue in jests repo) |
It's a SIGKILL, can't say for sure if it's related. I can't seem to replicate the error with the repro listed (first post). @zygopleural Is this from the same project? If we can get a reproduction that would be ideal. |
Yeah it is the same project as I used last time, just updated with I'll try with a fresh repo tomorrow morning 👍🏼 |
We haven't been able to reproduce this on our end @zygopleural Any updates on your end? |
I mean it is somewhat better |
@zygopleural Great to see v0.42 working! Those results are not unexpected as the improvements were specific to Web testing. What I found curious about my tests is how the API heap seemed to stabalize when run with the existing Web tests. Referring specifically to this result:
From this comment above. Still work to do here. Just pulling threads and appreciate your help doing so. |
@thedavidprice I just tried out with a new project ( yarn redwood generate component man
yarn redwood generate component woman
yarn redwood generate component boy
yarn redwood generate component girl
yarn redwood generate component dog
yarn redwood generate component cat This is the output from running tests:
Notice that the web tests are indeed fairly quick and the heap is consistent. It seems the problem is stemming from the API tests as the heap is still spiralling out of control. |
Heyoo... I've been trying to find a way to fix this, and I've made a little progress in #4096. There is still an open issue on Jest's repo that is related: jestjs/jest#12142 While the changes I'm making should reduce memory usage about 50%, I'm hopeful that the jest team will have a solution for this too on their side. Couple other things to note if you want to eek out a little bit more memory, a) you can also run jest/rw test with the |
UpdateBased on @dac09 fantastic work in #4096 there's now performance improvements on both Web and API sides. To be clear, we aren't saying API leak is resolved. But the heap seems to be reduced by about 50%. Here's a comparison using my test project. Before: using latest versionAfter: using code from #4096 |
UpdateGiven that there's been progress on this (in the coming v0.44) but not complete resolution, I am moving this topic to a new Issue with updated benchmarks and a reproduction repo: Closing this out. Look for v0.44 release comming asap |
Expected behaviour
yarn redwood test
should use ~ same heap size for each test unless the user has specifically done something wrong.i.e. the heap size should not spiral out of control just by creating more tests
What currently happens
The heap size spirals out of control by creating more tests
Steps to reproduce
1. Create new app
yarn create redwood-app --typescript test
2. Add some models to
./api/db/schema.prisma
Excuse the silly models, just something quick to generate tests.
3. Generate some tests
4. Run tests
yarn redwood test --logHeapUsage
5. Checkout heap spiral
The text was updated successfully, but these errors were encountered: