Bug Description
A memory leak occurs when frequently aborting fetch requests.
Reproducible By
Run the following code in Node.js.
import undici from "undici";
(function attack() {
const controller = new AbortController();
undici.fetch(
"http://idonotexist:9999",
{signal: controller.signal}
).catch(attack);
controller.abort();
}());
In less than a minute, I see memory usage of the Node.js process climb to several gigabytes.
Expected Behavior
Memory usage to remain stable, as is the case when you comment out the controller.abort(); statement.
Environment
$ uname -a
Darwin MacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64 arm Darwin
$ node -v
v20.4.0
Bug Description
A memory leak occurs when frequently aborting fetch requests.
Reproducible By
Run the following code in Node.js.
In less than a minute, I see memory usage of the Node.js process climb to several gigabytes.
Expected Behavior
Memory usage to remain stable, as is the case when you comment out the
controller.abort();statement.Environment