Skip to content
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

Server Memory leaks, high CPU usage - appConfig #20056

Closed
burda-osowiecki opened this issue Apr 3, 2023 · 9 comments
Closed

Server Memory leaks, high CPU usage - appConfig #20056

burda-osowiecki opened this issue Apr 3, 2023 · 9 comments

Comments

@burda-osowiecki
Copy link

burda-osowiecki commented Apr 3, 2023

Environment

  • Operating System: Darwin
  • Node Version: v18.15.0
  • Nuxt Version: 3.2.3
  • Nitro Version: 2.3.2
  • Package Manager: npm@9.6.2
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

I cannot reproduce it in small scale and ofc also cannot share our project code...
I hope someone other will have similar problem and be able to reproduce in from scratch.

Describe the bug

image
image
image

Additional context

We disabled all plugins and unnecessary third party libraries.
I was also trying the solution from this issue:
unjs/destr#9
I passed a parseResponse option to useFetch but it didn't change anything.

No response

Logs

No response

@danielroe
Copy link
Member

danielroe commented Apr 3, 2023

Would you provide a reproduction? 🙏

You don't need to share exactly your code, but sharing the kind of code you are running is a helpful start.

cc: @pi0

@burda-osowiecki
Copy link
Author

burda-osowiecki commented Apr 12, 2023

@danielroe, @pi0
Looks like the problem causes appConfig.
I moved the appConfig (which is constant object in our case, set in nuxt.config.ts) to key in runtimeConfig, then created a composable to return this object from runtimeConfig and replaced all usage of useAppConfig.
Thats the results. It also affects the CPU usage.
I'll try to create a reproduction.
image
image

@burda-osowiecki burda-osowiecki changed the title Server Memory leaks - ofetch parseResponse Server Memory leaks, high CPU usage - appConfig Apr 12, 2023
@danielroe danielroe self-assigned this Apr 14, 2023
@burda-osowiecki
Copy link
Author

burda-osowiecki commented Apr 17, 2023

@danielroe finally I prepared the reproduction.
https://github.com/burda-osowiecki/nuxt-memory-leak

npm run build
npm run start:debug
gtimeout 10 siege -c 10 http://localhost:3000

10 requests its enough to see how much it leaks, looks like it depends on how many data is in store's state.

@burda-osowiecki
Copy link
Author

burda-osowiecki commented Apr 19, 2023

@danielroe
App with reproduction - It resolves the problem
Our production app - It still leaks, so there must be something else :(

I'll try to create one more reproduction :/

@hoersamu
Copy link

We have the exact same issue. I'll try the useAppConfig workaround but it's causing a massive headache for us too.

@burda-osowiecki
Copy link
Author

@danielroe I'm trying to update Nuxt to 3.4.2 to check the leaks on latest version but I encountered new bug.
Luckily I made a reproduction #20473

@burda-osowiecki
Copy link
Author

burda-osowiecki commented Apr 26, 2023

@danielroe I've great news.
Looks like #20510 also resolves memory leaks!
(Tested on Nuxt 3.4.2, updated others dependecies like pinia to the latest and applied fix with callAsync)

#20340 is not necessary.

Please keep the thread open until we test it on production after uprading to 3.4.3 :)
Release of 3.4.3 is planned for Friday 28.04 right?

Copy link
Member

Fantastic - and you're definitely on top of testing this!

@burda-osowiecki
Copy link
Author

The problem is gone on 3.4.3!

Now the only one we have is: #20683

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants