nuxt / nuxt

The Intuitive Vue Framework.
https://nuxt.com
MIT License
54.07k stars 4.94k forks source link

Potential Memory Leak #28690

Closed dissy123 closed 1 week ago

dissy123 commented 2 weeks ago

Environment

Reproduction

Fresh nuxt 3.13.0 install via npx i tried different node versions like all major version, it is literally happening on every node version. when running with node --inspect .output/server/index.mjs

Describe the bug

Memory Leaking with SSR enabled when doing

ab -n 100 -c 50 "http://localhost:3000/"

image image

Additional context

No response

Logs

No response

github-actions[bot] commented 2 weeks ago

Would you be able to provide a reproduction? 🙏

More info ### Why do I need to provide a reproduction? Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making. ### What will happen? If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect. If `needs reproduction` labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it. ### How can I create a reproduction? We have a couple of templates for starting with a minimal reproduction: 👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz 👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox A public GitHub repository is also perfect. 👌 Please ensure that the reproduction is as **minimal** as possible. See more details [in our guide](https://nuxt.com/docs/community/reporting-bugs/#create-a-minimal-reproduction). You might also find these other articles interesting and/or helpful: - [The Importance of Reproductions](https://antfu.me/posts/why-reproductions-are-required) - [How to Generate a Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/minimal-reproducible-example)
danielroe commented 2 weeks ago

Is this new behaviour? Did you garbage collect before and after taking snapshots? And yes, I do need a reproduction. 🙏

dissy123 commented 2 weeks ago

https://github.com/dissy123/nuxt-memory-leak reproduction! :-)

I really don't know if it is new behaviour, because last weekend we fixed that memory leak in nuxt-booster https://github.com/basics/nuxt-booster/issues/1089, and afterwards i found another memory leak in my monorepository. I uninstalled all modules and everything i coded on my self and it was also there.

After that i then just checked out the bare actual version without everything and I also got a memory leak.

dissy123 commented 2 weeks ago

And Yes i did garbage Collection before Taking the snapshots :)

danielroe commented 2 weeks ago

I refreshed your lockfile + updated to Node v22 and could not reproduce.

CleanShot 2024-08-28 at 14 37 29@2x

Between each snapshot I ran:

ab -n 1000 -c 50 "http://localhost:3000/"

I launched the server with:

pnpm nuxi build && NODE_ENV=production node --enable-source-maps --inspect .output/server/index.mjs
github-actions[bot] commented 2 weeks ago

Would you be able to provide a reproduction? 🙏

More info ### Why do I need to provide a reproduction? Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making. ### What will happen? If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect. If `needs reproduction` labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it. ### How can I create a reproduction? We have a couple of templates for starting with a minimal reproduction: 👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz 👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox A public GitHub repository is also perfect. 👌 Please ensure that the reproduction is as **minimal** as possible. See more details [in our guide](https://nuxt.com/docs/community/reporting-bugs/#create-a-minimal-reproduction). You might also find these other articles interesting and/or helpful: - [The Importance of Reproductions](https://antfu.me/posts/why-reproductions-are-required) - [How to Generate a Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/minimal-reproducible-example)
Xenossolitarius commented 2 weeks ago

Need to add to this thread, although it's maybe not related. There seems to be a memory leak that has to do something with useHead. I am not sure when it started bcs we just started perf testing before the release. Seems the issue is reproducible when you crawl the site. Firing just one route will in most cases do nothing. I am unfortunately using all of the modules: nuxt-seo, i18n, vueuse etc etc. so i can't really isolate it. But I'll post here if i find the culprit.

dissy123 commented 2 weeks ago

interesting just tried it again. Deleted the lockfile and executed the commands you provided.

image

Will check my system again, will have more time next week.

Xenossolitarius commented 2 weeks ago

image image

Hmm same stuff here. Is it the latest useHead update? My nuxt version is 3.12.4 and use head is 1.10.0

Xenossolitarius commented 2 weeks ago

@dissy123 are you using useHead server side in nuxt plugins. I mean not in the setup script ?

dissy123 commented 2 weeks ago

@Xenossolitarius the reproduction is just an empty nuxt project without anything else.

dissy123 commented 1 week ago

sorry, guys, just fixed it with uninstalling all node versions, i also had n and nvm installed maybe this caused the problem but it now seems to good again! thank you! ;)

danielroe commented 1 week ago

delighted to hear it! 🔥

dissy123 commented 1 week ago

@danielroe but we found a memory leak with pinia the reproduction is in this ticket, should i make a new one here?

https://github.com/vuejs/pinia/issues/2762

manniL commented 1 week ago

@dissy123 different dependenices/setup, so better create a new issue 👍