-
Notifications
You must be signed in to change notification settings - Fork 566
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
unidict fetch leaked if using Request object as argument #1823
Comments
Seems like we trying to copy AbortController signal from the income Request here: and after locking into the arrow function, such signal from the previous Request: seems like we never run finalization for the original signal. Not sure here, but a bug exists... maybe we should do |
Isn't this just a case of the finalisation registry not yet running the finaliser? |
hmm seems like it's never running, and at the same time this: export function create_fetch({ event, options, state, get_cookie_header }) {
return async (info, init) => {
return await fetch(info, init);
};
} working prefect. |
Seems like this https://github.com/nodejs/undici/blob/main/lib/fetch/request.js#L337 is needed only if |
As I understand, we shouldn't recreate the Request inside Maybe I do not fully understand the concept behind this, but it seems like we are doing something wrong now. |
Sorry, for too many words here. I checked the specification https://fetch.spec.whatwg.org/#fetch-method and it seems like, currently, everything is implemented right. I still have questions about such specifications but this question is outside this issue. @ronag big thanks for a fast fix. |
@ronag can you reopen? The latest changes make memory leak again. |
@stalkerg We need a minimal repro to properly solve this. |
@ronag can you try repro from #46435 ? But seems like this time, the reason for the memory leaks is not in |
Okey, it's Yes, I can confirm now the new undici memory leaked again. |
The reproduction in #46435 causes a memory leak in Node.js v19.8.1. |
@jamesdiacono thanks, I had a theory that it was fixed in v19.3 but seems like no, and we have some GC issue that can't collect self-linked things properly. |
The problem was fixed, but has now regressed. I have only experienced the leak in relation to fetch. |
Bug Description
unidict leaked if using Request, for example:
I found it in SvelteKit inside this issue sveltejs/kit#8239
Reproducible By
See SvelteKit issue.
Environment
Ubuntu and Gentoo with the latest node 18
The text was updated successfully, but these errors were encountered: