-
Notifications
You must be signed in to change notification settings - Fork 994
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]: @redwoodjs/testing/config/jest/api
causes a memory leak on api side tests
#6322
Comments
From my own debugging, with the standard repro I get
If I comment everything out in
If I just comment out the
If I keep the -const { getConfig, getDMMF } = require('@prisma/sdk')
+const { getConfig, getDMMF } = require('@prisma/sdk/dist/engine-commands')
-const { setContext } = require('@redwoodjs/graphql-server')
+const { setContext } = require('@redwoodjs/graphql-server/dist/globalContext')
const { getPaths } = require('@redwoodjs/internal/dist/paths')
-const { defineScenario } = require('@redwoodjs/testing/dist/api')
+
+const { defineScenario } = require('../../../dist/api/scenario') I get:
i.e. heap is not increasing at such a fast pace and the tests are running significantly faster due to smaller import sizes (i.e. not importing the whole of the Prisma SDK. |
Not sure if it's related, but it's also slightly alarming that this trivial test suite is taking >10s 😅 |
FYI, if I put the
i.e. heap still out of control, but tests are significantly quicker |
@redwoodjs/testing/config/jest/api
causes a memory leak@redwoodjs/testing/config/jest/api
causes a memory leak on api side tests
Hello both - thank you for reporting this and the reproduction. I just merged in a few changes (mainly targetting the web side) in #6281 - would you like to try this out in your real project to see if it improves things for you?
I'll try it in your reproduction in the mean time. |
Possibly related to #4360 |
Hey so spent some time trying to improve speed/memory here - but I want to point out something important - the reproduction doesn't actually have any scenarios, or real usecases. It's a tradeoff between being able to write scenarios, and seed the db without more boilerplate in each test vs keeping jest as vanilla as possible. |
Adding this one to the current cycle just so we keep seeing it and thinking about next steps. |
hey @dac09 @jtoar is this being looked into please? memory leak is killing our apps test and our CI bills. We have to introduce excessive (and expensive) parallelism in order to have small enough test suites, so that they don't eat away all the memory. This is a major issue for us and causes so much pain that we don't really consider redwood test helpers production ready and are considering moving away from it unless this gets resolved |
@jan-stehlik it's still on our radar, but progress is sporadic right now. Preparing for v5 (react 18) is taking most of our attention; at first it seemed like it would take a long time but things are looking optimistic, so our attention may return to this fairly soon. We've heard many complaints about the speed but not as many about the memory. I know those are related to some extent. Unless you've already connected with one of us, maybe it's worth connecting to see what you're doing in your project and if we can offer any tips to alleviate things for the time being? |
What's not working?
At Nous our Redwood test suite has become incredibly resource hungry, to the point that we can't actually run the entire suite on our local machines. We can just about run it on CI by splitting the work between multiple GHA jobs.
After some investigation it's clear that we have a huge memory leak. And one of the contributors seems to be
@redwoodjs/testing/config/jest/api
, which leaks memory even with the most trivial test suite.Apologies if this is something you're already aware of - I searched for similar issues but no luck 🙈
Otherwise our experience with Redwood remains very positive, thank you team for all your hard work 🙏
How do we reproduce the bug?
https://github.com/project-nous/redwood-jest-memory-leak-repro
What's your environment? (If it applies)
No response
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: