-
Notifications
You must be signed in to change notification settings - Fork 10.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
Gatsby develop refresh endpoint memory leak #25868
Comments
Hi @apaniel90vp! Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction either in a public repo or on something like codesandbox. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it. If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look. Thanks for using Gatsby! 💜 |
@apaniel90vp It's more likely an issue with gatsby-source-contentful than with gatsby refresh endpoint. Do you see the same behaviour without contentful? |
@wardpeet that is a very good point, probably without contentful plugin it doesn't happen, as I can see the highest memory peak while generating the schema. I won't be able to check this today, but I will do tomorrow! Thanks! |
I can confirm that I saw this happening as well. Any help to identify where it is coming from is very welcome :) |
Has anyone identified the root issues with this? I've been having issues this week with memory. Nothing major has changed, so the sudden error is driving me crazy :/
When running gatsby build with more memory it stalls at
Not sure what the best way to debug it further. ... in further debugging. Removed all plugins except two entries for the contentful sources. Current error...
|
@AnalogMemory do you use Rich Text? There is a bug in the current version of the source plugin which blows up your memory as soon you have Rich Text and some content referenced with a circular reference. The canary version at #25249 does fix this issue |
@axe312ger Yeah I finally figured out it was a combo of
One of my content editors started using more of them just before it happened. Seems to be fine with a few, but when over a 100 entries were linking to each other it was killing the memory when gatsby-contentful-source was trying to build the queries. I tried the gatsby-contentful-source@next version but it would have been more work to rewrite things and didn't want to push it out to production in that state. Ended up finding a patch that @disintegrator posted and using that to hold me over till a proper release is ready :) I do have a task to test out the next version when I'm back from vacation next week Thanks! |
@AnalogMemory Please continue discussion in #24221 as this ticket originally is about a memory leak bug in the browser while developing, not when sourcing the nodes on bootstrap. |
We're struggling with this issue as well. We are using the refresh endpoint to enable preview functionality for our content authors, so it is called frequently. Each call incrementally increases memory consumption until the application crashes. Docker running node:12.18.3-alpine3.11 "gatsby": "^2.23.3", |
Did anybody yet figure out what data is bloating the memory? Or which call is causing it? Any help in research is very much appreciated :) |
I experience the same behaviour with WordPress using |
Can you try |
This should be fixed since a while. If you still experience this issue, and use the latest version of gatsby-source-contentful, pls let us know |
Description
Each time the refresh endpoint is hit, memory increases a little bit and it doesn't go down, eventually leading to a heap out of memory after multiple refreshes.
develop process memory previous to a refresh:
develop process memory after a refresh:
and hitting more times refresh it just goes higher.
adding --max_old_space_size to a high value just delays the out of memory.
Steps to reproduce
gatsby develop
hit refresh endpoint
wait until refresh finishes
hit refresh endpoint
...
Expected result
Memory should not increase without getting back to normal over time.
Actual result
Eventually there is a memory leak
Environment
System:
OS: Windows 10
CPU: (12) x64 Intel(R) Xeon(R) CPU E5-1650 v4 @ 3.60GHz
Binaries:
Yarn: 1.21.0 - C:\Users\apa\AppData\Roaming\npm\yarn.CMD
npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 3.8.3 - /c/Python38/python
Browsers:
Edge: 44.17763.831.0
npmPackages:
gatsby: 2.24.2 => 2.24.2
gatsby-graphiql-explorer: ^0.2.31 => 0.2.31
gatsby-plugin-react-decorators: 0.0.4 => 0.0.4
gatsby-plugin-react-helmet: ^3.1.18 => 3.1.18
gatsby-plugin-sass: ^2.1.26 => 2.1.26
gatsby-plugin-sharp: ^2.3.9 => 2.3.9
gatsby-plugin-typescript: ^2.1.23 => 2.1.23
gatsby-source-contentful: ^2.3.15 => 2.3.15
gatsby-source-filesystem: ^2.1.42 => 2.1.42
gatsby-transformer-json: ^2.2.22 => 2.2.22
gatsby-transformer-sharp: ^2.3.9 => 2.3.9
The text was updated successfully, but these errors were encountered: