Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@sveltejs/[email protected] make memory leak #9512

Closed
stalkerg opened this issue Mar 25, 2023 · 7 comments · Fixed by #9591
Closed

@sveltejs/[email protected] make memory leak #9512

stalkerg opened this issue Mar 25, 2023 · 7 comments · Fixed by #9591

Comments

@stalkerg
Copy link
Contributor

Describe the bug

Basically, every 5min, I have an extra 100mb to the process. Originally I thought about undici lib same as last time #8239 but seems like now times it's something new.

Reproduction

I have a load on the production server for the node project. If it's will not an obvious reason I will try to make a reproduction.
But seems like will be simpler to bisect changes.

Logs

No response

System Info

System:
    OS: Linux 5.4 Ubuntu 20.04.5 LTS (Focal Fossa)
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
    Memory: 36.95 GB / 62.81 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 18.12.1 - /usr/bin/node
    npm: 8.19.2 - /usr/bin/npm
  npmPackages:
    @sveltejs/adapter-node: 1.2.2 => 1.2.2 
    @sveltejs/kit: 1.14.0 => 1.14.0 
    @sveltejs/svelte-virtual-list: github:sveltejs/svelte-virtual-list => 3.0.1 
    svelte: 3.57.0 => 3.57.0 
    vite: ^4.2.1 => 4.2.1

Severity

blocking an upgrade

Additional Information

No response

@stalkerg
Copy link
Contributor Author

stalkerg commented Mar 25, 2023

Yes, it's still undici, adapter-node just merge such lib into shim.js.
#8239 is still valid.

PS why do we merge such libs into the adaptor package if we have undici as a separate package?

@machycek
Copy link

machycek commented Apr 3, 2023

I can vouch for this as well. We have a lot of restarts in our adapter-node app after upgrading.
image

@bluwy bluwy mentioned this issue Apr 3, 2023
5 tasks
@bluwy
Copy link
Member

bluwy commented Apr 3, 2023

Made a PR to revert this: #9591

Another way to workaround this for now is to use overrides in package.json

npm:

"overrides": {
  "undici": "5.20.0"
}

pnpm:

"pnpm": {
  "overrides": {
    "undici": "5.20.0"
  }
}

@stalkerg
Copy link
Contributor Author

stalkerg commented Apr 3, 2023

Seems like the developer is bussy now nodejs/undici#2025 probably, we need to drill down to V8/Node C++ code to explain why this leak happens.

@stalkerg
Copy link
Contributor Author

stalkerg commented Apr 3, 2023

@bluwy

Another way to workaround this for now is to use overrides in package.json

no, it's not working because undici merged into shims.js from @sveltejs/adapter-node

@bluwy
Copy link
Member

bluwy commented Apr 3, 2023

I don't understand what you mean by undici merging into it? It's derived from this file, which is a dependency before you bundle your app.

@stalkerg
Copy link
Contributor Author

stalkerg commented Apr 4, 2023

@bluwy no, it's bundling during @sveltejs/adapter-node deploy to NPM; you can check the package and shim file here https://www.npmjs.com/package/@sveltejs/adapter-node?activeTab=code or in your node_modules folder.
It's included separately here https://github.com/sveltejs/kit/blob/6b6f4565c9f1486cb43e921113f145e001078090/packages/adapter-node/src/shims.js and bundling happened here

plugins: [nodeResolve(), commonjs()],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants