undici icon indicating copy to clipboard operation
undici copied to clipboard

spec doesn't finalize connection on network error

Open ronag opened this issue 2 years ago • 4 comments

I've been reading through the spec a few times now and there seems to be missing a connection cleanup somewhere.

The problem is that whenever we replace response with a network error (example) that means that we no longer will read that response nor do we close the associated connection. Effectively leaking the connection.

Is this a bug in the spec or am I missing something? Maybe we need a "terminate" in fetch finale?

ronag avatar Aug 13 '21 05:08 ronag

@szmarczak @annevk

ronag avatar Aug 13 '21 05:08 ronag

https://github.com/nodejs/undici/commit/42b67e12b3b62a47789b7bf6ea4a64be8d8a9f25

ronag avatar Aug 13 '21 05:08 ronag

Or maybe the spec assumes that GC should handle this? https://github.com/nodejs/undici/pull/950

ronag avatar Aug 13 '21 06:08 ronag

Indeed. I believe the connection should be terminated.

szmarczak avatar Aug 13 '21 10:08 szmarczak