Skip to content
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.

SSR + vue-i18n starter kit issue (memory leak) #166

Closed
12 tasks
zknic opened this issue Aug 20, 2021 · 8 comments
Closed
12 tasks

SSR + vue-i18n starter kit issue (memory leak) #166

zknic opened this issue Aug 20, 2021 · 8 comments

Comments

@zknic
Copy link

zknic commented Aug 20, 2021

Describe the bug
nodejs server can not release memory after http request end.it cause server's memory less and less, finally nodejs used up the server's memory and the server is down.

Codepen/jsFiddle/Codesandbox (required)
Fork a Codepen (https://codepen.quasar.dev) or a jsFiddle (https://jsfiddle.quasar.dev) or a Codesandbox (https://codesandbox.quasar.dev) and hit save then copy-paste link here.

To Reproduce
Steps to reproduce the behavior:

  1. quasar create app xxx
  2. quasar mode add ssr
  3. quaasr build -m ssr
  4. node index.js or pm2 start index.js
  5. monit the node server
  6. user webbwnch to make a large number of requests
  7. Memory growth very quickly
  8. after all requests ends, memory can not been released until the server is down.
  9. dump the memery shapshot
  10. Analysis the memory shapshot

image

image

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):
Quasar Version:
@quasar/app Version:

Quasar mode:

  • SPA
  • [x ] SSR
  • PWA
  • Electron
  • Cordova
  • Capacitor
  • BEX

Tested on:

  • SPA
  • [x ] SSR
  • PWA
  • Electron
  • Cordova
  • Capacitor
  • BEX

OS: linux, windows
Node: v14
NPM: 6.13
Yarn:1.22
Browsers:
iOS:
Android:
Electron:

Additional context
Add any other context about the problem here.

@rstoenescu
Copy link
Member

Cannot reproduce. Can you tell me your exact Node version and OS (including its version) pls?
This has been tackled in the beta versions already.

Can you try with "@quasar/app" v3.1.0 which has updated Vue and Vue Router versions and tell if you can still reproduce it? If you can, then at this point it means that there's a high chance the culprit might be Vue itself.

@zknic
Copy link
Author

zknic commented Aug 23, 2021

Cannot reproduce. Can you tell me your exact Node version and OS (including its version) pls?
This has been tackled in the beta versions already.

Can you try with "@quasar/app" v3.1.0 which has updated Vue and Vue Router versions and tell if you can still reproduce it? If you can, then at this point it means that there's a high chance the culprit might be Vue itself.

Node: v14.16.1
OS: centos-release-7-4.1708.el7.centos.x86_64
kernel: 3.10.0-693.el7.x86_64

i have tried "@quasar/app" v3.1.0, it has the same problem. later i uesd "vue-cli" v4.5.13 to build a ssr project, the project has the same problem. (vue: 3.2.4, vue-router:4.0.11).it seems the culprit is Vue itself.
image

@zknic
Copy link
Author

zknic commented Aug 23, 2021

Cannot reproduce. Can you tell me your exact Node version and OS (including its version) pls?
This has been tackled in the beta versions already.
Can you try with "@quasar/app" v3.1.0 which has updated Vue and Vue Router versions and tell if you can still reproduce it? If you can, then at this point it means that there's a high chance the culprit might be Vue itself.

Node: v14.16.1
OS: centos-release-7-4.1708.el7.centos.x86_64
kernel: 3.10.0-693.el7.x86_64

i have tried "@quasar/app" v3.1.0, it has the same problem. later i uesd "vue-cli" v4.5.13 to build a ssr project, the project has the same problem. (vue: 3.2.4, vue-router:4.0.11).it seems the culprit is Vue itself.
image

The culprit should be vue-router. when i remove vue-router in vue-cli ssr project, the problem has been solved.

@rstoenescu
Copy link
Member

Thank you for the reply.

In this case, can you open a ticket on the vuejs/vue-router-next repo pls? Also tag this ticket from there, so the other developers coming to Quasar can track this issue and its resolution.

Will close this ticket in the meantime, but will follow closely the vue-router one.

@zknic
Copy link
Author

zknic commented Aug 24, 2021

Thank you for the reply.

In this case, can you open a ticket on the vuejs/vue-router-next repo pls? Also tag this ticket from there, so the other developers coming to Quasar can track this issue and its resolution.

Will close this ticket in the meantime, but will follow closely the vue-router one.

sorry, i made a mistake. i did more test yesterday by using quasar framwork. when i create new project whitout i18n, the problem has been sovled.
vue-router's problem depends on which way you create the instance, quasar handled vue-router very well.

1.quasar create xxx
2.choose i18n
3.quasar mode add ssr
4.quasar dev -m ssr
5.use webbwnch to make a large number of requests

@zknic
Copy link
Author

zknic commented Aug 24, 2021

image

Modify as above, this can also prevent the server-side memory leak.

@rstoenescu
Copy link
Member

Can you try putting the createI18n() inside of the default exported function pls and retest? (Also drop the other export)

@rstoenescu rstoenescu reopened this Aug 24, 2021
@rstoenescu rstoenescu changed the title quasar v2 ssr mode server-side Memory leak SSR + vue-i18n starter kit issue (memory leak) Aug 24, 2021
@zknic
Copy link
Author

zknic commented Aug 25, 2021

Can you try putting the createI18n() inside of the default exported function pls and retest? (Also drop the other export)

you are right.
image

i tested these code, the project has the correct effect, no more memory leak.
image

@rstoenescu rstoenescu transferred this issue from quasarframework/quasar Oct 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants