question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module versions (please complete the following information):

  • vue:v2.4.1
  • vue-i18n:v8.24.2

Question

My Project is using Vue SSR, when tests stress by the ab tool, the memory increases all the time. But when I remove the vue-i18n and tests again, the memory does not increase. So I guess the vue-i18n exists ssr memory leak, what I want to ask that is there anyone has the same question and how to solve? Thanks.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kazuponcommented, Aug 4, 2021

@0Rick0 Thank you for your repro repo!

It’s very hard to make the memory leaks reproduce. We appreciate your information.

The memory leaks might be affected by the javascript code, and with Vue core code. So, please understand that it will take some time to fix.

1reaction
0Rick0commented, Jul 27, 2021

We’ve seen a similar issue crop up in our application. Taking a heap dump of the application during a stress test there where a lot of watchers on the VueI18n object.

We’ve solved this by patching out the watchI18nData method after calling it once. I will see if I can post a minimal example later this week.

I’m not entirely sure if it has any other side effects that I’m not aware of. But as I understand the this._vm.watch('$data', () => {}) only needs to be created once.

The patch we used:

Vue.use(VueI18n);
const i18n = new VueI18n({
    messages: {},
});
// create one watcher at the start, and don't create any watchers at runtime.
i18n.watchI18nData();
i18n.watchI18nData = () => {};
Vue.mixin({
    i18n,
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Learn How to Debug the Cause of Memory Leak in SSR
To find the causes of memory leaks, it is efficient to take a look at the very large retained size for shallow size....
Read more >
Hunting memory leaks in a server side rendered React ...
Our memory leak was caused by reselect and with the bad usage of styled-components, both problems were found by using Chrome DevTools. Backstory....
Read more >
Memory leak when using computed is SSR mode · Issue #5208
A leak would be if you destroyed all of these Posts again and memory usage would not decrease to the same level.
Read more >
Debugging Memory Leaks in Node.js Applications - Toptal
Memory leaks in long running Node.js applications are like ticking time bombs that, if left unchecked in production environments, can result in devastating ......
Read more >
Server-Side Rendering Coding Guidelines - Spartacus ... - SAP
Avoiding Memory Leaks in SSR ... In the SSR server, there is one long-living Node.js process that handles all HTTP requests. On each...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found