-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Storyshots is leaking memory #3286
Comments
I think we have narrowed down where the leak is. Our project has 198 test suites and we see large increase for each one with We eliminated that (and had tests running same as usual) by commenting out lines in
We're on 5.3.14. Before (machine has 64gb RAM):
After:
|
This is now causing issues for our workflow as well. We were unable to upgrade our storybook dependencies (including storyshots) from version 5.2.6 to 5.3.18 as our jest run would just fail with memory allocation errors. |
We had the same problem and fixed it for us by separating our storyshots by folder into different testsuites. We accomplished this by creating separate Storyshot files and using the |
I've ran into this issue too with Storybook. Had my storybook open for a few days working on my own design system and it ended up eating up 19GB of ram (well my computer doesn't have that much ram so of course it swapping). On a Mac with the latest OS updates and using the MDX plugin too. |
I've ran into this issue too and while waiting for the fix, we fixed it by mocking @storybook/core/server. This solution was inspired by #3286 (comment) Thank you @jrmurad
Also here is a great article that helped me a lot finding memory leaks : https://chanind.github.io/javascript/2019/10/12/jest-tests-memory-leak.html |
@vidal7 do you know what the proper storyshots fix would be for that? |
@shilman, I think so. Maybe just changing in this file (addons/storyshots/storyshots-core/src/frameworks/configure.ts) a import. So Change To I think it will work. The problem is that importing toRequireContext from '@storybook/core/server'; imports too much things in addons/storyshots/storyshots-core/src/frameworks/configure.js. Because of typescript compilation to javascript, the first import is compiled to |
Oof that's pretty ugly though. @ndelangen @tmeasday WDYT about a little refactoring here? |
This might work: import { toRequireContext } from '@storybook/core/dist/server/preview/to-require-context'; ? |
+1 |
Do we think running all these node processes in docker by limiting resources will help ? |
@vidal7 is it inside the index.spec.js before the initStoryshot()? |
@dheerajk02 , in a jest setup file |
It's been changed to
Which -I think- solved the issue.. |
Bug or support request summary
Bug
Steps to reproduce
See https://github.com/SimenB/storyshots-leak for example, but every single installation of storyshots (at least for React, haven't tested others) should reproduce without issue following the steps in the linked README.
To satisfy template:
logHeapUsage
anddetectLeaks
) or using some OS tool to see memory usage.Please specify which version of Storybook and optionally any affected addons that you're running
Affected platforms
Screenshots / Screencast / Code Snippets (Optional)
(A bonus would be to remove the
info => Loading custom .babelrc
text...)The text was updated successfully, but these errors were encountered: