Open Jarred-Sumner opened 1 month ago
@cirospaciari did you fix this? I think you might've
Its not fixed yet, but is a easier fix now, today fetch has a strong ref with the fetch task if we start streaming and will buffer the full body waiting, we can switch for a weak ref here too but I remember that I did not fix it because it was finalizing too early and I did not handle pending reads correctly. In short we need to keep alive until pending reads (probably ref counting here) are finish and after this deinit and ignore the rest.
In the fetch() client, if we've started to read an in-flight response body but do not finish reading it and neglect to call
cancel
on theReadableStream
, then we do not close the stream and the response body leaks. Node.js'fetch
has the same bug.Client:
Server:
Something involving the ReadableStream reader needs to either be a
WeakRef
in JS or aJSC::Weak
in Zig/C++.