i18n: Version 8.0.0 rc 9 throws memory leak
Environment
- Operating System:
Linux - Node Version:
v20.5.1 - Nuxt Version:
3.8.2 - CLI Version:
3.10.0 - Nitro Version:
2.8.1 - Package Manager:
npm@9.8.0 - Builder:
- - User Config:
- - Runtime Modules:
- - Build Modules:
-
Reproduction
This graph its our application with i18n 8.0.0 rc 9, with one screaming frog crawl with 20 simultaneous threads and one Jmeter with 100 threads simultaneously.
The memory raises and the garbage doesnt recollect the memory (The drop that is seen is because we restart the server automatically when we reach a certain threshold)
The same situation (the same packages and config), but with i18n 8.0.0 rc 5 (only we change the version of this library)… the memory is stable.
Describe the bug
This graph its our application with i18n 8.0.0 rc 9, with one screaming frog crawl with 20 simultaneous threads and one Jmeter with 100 threads simultaneously.
The memory raises and the garbage doesnt recollect the memory (The drop that is seen is because we restart the server automatically when we reach a certain threshold)
The same situation (the same packages and config), but with i18n 8.0.0 rc 5 (only we change the version of this library)… the memory is stable.
Additional context
No response
Logs
No response
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Reactions: 3
- Comments: 43 (1 by maintainers)
¡¡VERSION 8.0.1 works fine!!
I can confirm that it’s reproducible on rc6 too, as well as rc7, rc8 and rc9.
I reproduce and profile the memory leak with a fresh
nuxt@3.8.2install with only@nuxtjs/i18n@8.0.0-rc.7and a page using thetfunction in the template block.Like @agracia-foticos, I can confirm that there is no memory leak in version rc5. rc6 wouldn’t build so I tested rc7, rc8 and rc9, all have the memory leak.
I profile the different build by running
node --inspect .output/server/index.mjsand doing multiple heap snapshots with some loads between each.Here’s the snapshots for the rc5 version (memory is stable)
Here’s the snapshots for the rc7 version (memory is leaking)
@agracia-foticos, perhaps your issue is related to using
awaitbeforecomputed, whereuseNuxtApp().$i18n.t()is called: https://github.com/nuxt-modules/i18n/issues/2629I close the issue! Thank you very much!
@BobbieGoede I created an internal ticket. I’ll follow up here when I have more infos 😉
I test crawling our site with screaming frog This is the graph with 5 simultaneous threads. Memory leak seams to dissapear
This is the graph with 30 simultaneous threads. Memory leak seams to dissapear.
@agracia-foticos Have you tried removing
node_modulesand lockfiles and running install again? That should solve dependency issues updating from older release candidate versions.I will test it. I’ll let you know with news
@agracia-foticos @szwenni The leak should also be gone when using
asyncContextwith the latest edge release, curious to hear if it is resolved in your projects 🙏I have multiple ‘await stores’ before computed properties with t() 😦
Added useHead here https://github.com/s00d/max-call-err No leakage on version 11, tested via ab
after 1000 requests, the RAM usage returned back and consumes less than 1 MB If the problem still exists, it lies elsewhere
@agracia-foticos Can you check again with
rc.11? If you’re still experiencing this leak withrc.11I will need more information to be able to debug it.If a reproduction isn’t possible I would at least like to know where and how you use this module, inside plugins, middleware, whether you use translations inside head tags, inside Pinia and so on. Hopefully we can get this fixed and get v8 stable! 😄
@thomaspaillot You are likely running into the issue described here https://github.com/nuxt-modules/i18n/issues/2034#issuecomment-1855097787, I have a PR lined up to resolve that https://github.com/nuxt-modules/i18n/pull/2621.
If possible, I would like to find out from which version this is happening. Can you reproduce the memory leak in each between rc.6 and rc.9? 🙏