-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Memory leak? #9427
Comments
@kevinrenskers this issue appears to be related to Undici, which is used under the hood for the |
Is that being tracked in their repo somewhere? Switching to Axios is not really an option, I don't have time to go through the entire app to make such a refactor. |
This should be closed by #9591 where we pin undici's version. |
I don't think that helped, it keeps increasing in basically the same speed as before; 30 MB in 2 hours. Which doesn't sound like a huge amount, but is 360 MB per day. Update: It just keeps on rising, no change. Is nobody else seeing this? Or is nobody else tracking their server stats? Update 2: 🤷♂️ |
@kevinrenskers we are having the same issue actually |
@kevinrenskers |
The default server, using adapter-node. |
And this also happens with npm run preview? |
I don't know, I don't want to run my production website that way to find out 😅 I'll try it locally, see what happens. |
can you please confirm the exact versions of operating system, node, @sveltejs/kit, @sveltejs/adapter-node and undici where you are observing this behavior? |
undici: 5.20.0 |
Yes |
Can you try
I have no issue now. Also, undici devs fixed such a memory leak (very tricky way actually!). |
I'm already using undici 5.20.0 though, but sure I'll try. Where do I put these overrides? |
on the same level as |
So far it seems improved, but I'll know for sure in a day or so. I'll report back. Update: after 4 hours memory usage has increased by about 15 MB. Let's see what's it like in 24 hours. |
I think the leak is indeed solved 🎉 |
@stalkerg am I seing this correctly that undici has released the fix for the memory leak in https://github.com/nodejs/undici/releases/tag/v5.21.1 so we can bump to latest undici again? |
@dummdidumm yes! Now it's fixed without a timeout breakage. My small local tests are working well. |
No, it has not released yet. |
Is there an ETA on a release? So I can decide if I should revert my change or just wait a bit. |
It's out now! :) https://github.com/sveltejs/kit/releases/tag/%40sveltejs%2Fkit%401.15.8 |
@s3812497 it's not enough; we also must update the node adapter because of bundling (this issue is not in direct dependencies) |
Ah, sorry about that. I didn't know. |
@s3812497 |
@dummdidumm we must update |
Can we fix this asap ? Our production server capacity is lost by more than 100%. Basically we need to have more than twice the servers and the perf has become really bad as well. We have no choice other than to pin down adapter node. Can this issue get more traction ? |
sveltejs/kit#8239 sveltejs/kit#9427 Hay que vigilar si se resuelve el problema de undici
About 1.5 years later I experience this same problem. I thought this thread would help me but since I run svelte-kit 2.5.4 I guess the above fix should already be there. Maybe a similar problem has arised again? Or should I continue look elsewhere? |
@henryson did you use latest stable nodejs? Also, are you sure you have totally same issue? You can go to undici tracker than. |
Hi, thanks for quick response.
No I am not sure at all. But our app hangs after less than a day (in production) and I am trying to look for all ways to fix this.
We were running node 21.7 but I downgraded to 20.18.1 because some other post said it could work. But it didn’t.
Cheers, Josef
Från: Yury Zhuravlev ***@***.***>
Datum: fredag, 29 november 2024 09:15
Till: sveltejs/kit ***@***.***>
Kopia: Josef Henryson ***@***.***>, Mention ***@***.***>
Ämne: Re: [sveltejs/kit] Memory leak? (Issue #9427)
@henryson<https://github.com/henryson> did you use latest stable nodejs? Also, are you sure you have totally same issue? You can go to undici tracker than.
—
Reply to this email directly, view it on GitHub<#9427 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACC72JZBEYUC2XT4OPPKSBT2DAPAXAVCNFSM6AAAAABSWRTB36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMBXGI4TGMRQGI>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
You should isolate your issue and make small reproduction demo. Without it, any suggest will not too different from random advice. |
this specific issue has been resolved. it makes no sense to discuss all possible memory leaks in the comments here and notify participants in the process. - locking it now, please file a new one with a reproduction and downloadable heap snapshots for comparison that show it is actually sveltekit causing the memory leak. If you are unsure how to do this, please join https://svelte.dev/chat and ask for help in |
Describe the bug
I am seeing the memory usage of my SvelteKit app, running with the Node adapter, going up and up. I'm not sure how the server's memory usage can keep increasing, all the svelte stores for example are only used in the browser, and other than that the server requests should be stateless, right?
See https://discord.com/channels/457912077277855764/1081891569390583898 for a discussion about this.
Reproduction
As far as I know, any project will show this problem.
Create a new skeleton project. No need to add TypeScript, Prettier, ESLint or anything else.
Open http://127.0.0.1:4173/, open the activity monitor (on macOS) or
top
or whatever else to see memory usage of the Node process, and refresh the webpage a whole bunch of times. You'll see the memory go up. It's slow to increase with such a simple skeleton project so you might need to refresh a whole bunch of times, but it does go up.In my moderately popular website it goes up by about 300 MB per day.
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
I have to restart my Node server once in a while or the server just runs out of memory.
The text was updated successfully, but these errors were encountered: