diff --git a/.changeset/slimy-seas-type.md b/.changeset/slimy-seas-type.md new file mode 100644 --- /dev/null +++ b/.changeset/slimy-seas-type.md @@ -0,0 +1,5 @@ +--- +'fetch-nodeshim': patch +--- + +Unref the incoming socket when the timeout is disabled, to prevent body streams that never start from keeping processes alive diff --git a/src/fetch.ts b/src/fetch.ts --- a/src/fetch.ts +++ b/src/fetch.ts @@ -149,6 +149,7 @@ const outgoing = protocol.request(requestOptions); outgoing.on('response', incoming => { incoming.setTimeout(0); // Forcefully disable timeout + incoming.socket.unref(); const init = { status: incoming.statusCode,