Description
Reporting a bug?
Using vite-plugin-ssr
to run Vue 3 with server side rendering, leaving the legacy api enabled will cause memory to slowly increase with every request.
Expected behavior
Memory does not unexpectedly keep increasing.
Reproduction
I have reproduced a minimal example here https://github.com/DoubleJ-G/vue-i18n-memory-leak
I have also created a branch legacy-disabled
to demonstrate the issue does not happen with it disabled.
System Info
System:
OS: Linux 5.13 Pop!_OS 20.04 LTS
CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Memory: 1.18 GB / 15.55 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.0/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
Browsers:
Chrome: 91.0.4472.77
Firefox: 93.0
npmPackages:
@vitejs/plugin-vue: ^1.9.3 => 1.10.2
@vue/compiler-sfc: ^3.2.20 => 3.2.29
@vue/server-renderer: ^3.2.20 => 3.2.29
vite: 2.6.7 => 2.6.7
vite-plugin-ssr: ^0.3.31 => 0.3.51
vue: ^3.2.20 => 3.2.29
vue-i18n: ^9.2.0-beta.30 => 9.2.0-beta.30
Screenshot
Running 20,000 requests with legacy enabled:
Running 20,000 requests with legacy disabled:
Additional context
From some memory debugging I pinned it down to vue-i18n.cjs.js line 1549 which is the beforeCreate()
hook. I could not pin point it further, but if I comment out the hook the issue also seems to be resolved. I believe this may be an issue because Vue docs state unmounted()
is not called on the server side, which seems to be were the cleanup should run.
Validations
- Read the Contributing Guidelines
- Read the Documentation
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion
- The provided reproduction is a minimal reproducible example of the bug.