-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Closed
Labels
abortcontrollerIssues and PRs related to the AbortController APIIssues and PRs related to the AbortController APIfetchIssues and PRs related to the Fetch APIIssues and PRs related to the Fetch API
Description
Version
20.11.0
Platform
Microsoft Windows NT 10.0.22631.0 x64
Subsystem
undici
What steps will reproduce the bug?
There was an issue #48478 with repoduction https://github.com/Robert-Schirmer/nodejs-mem-leak, and it is not reproducible.
However AbortController still leaks in terms of FinalizationRegistry:
const r = new FinalizationRegistry((tag) => console.log(tag));
function alloc() {
let counter = 0;
(function allocateMemory() {
Array.from({ length: 50000 }, () => () => {});
if (counter > 5000) return;
counter++;
setTimeout(allocateMemory);
})();
}
function test1() {
let x = ['foo', 'bar']
r.register(x, 'test1')
x.length
}
async function test2() {
const ac = new AbortController()
r.register(ac, 'test2')
await fetch('https://nodejs.org', {
signal: ac.signal,
})
}
test1() // test1
test2() // no output
alloc()How often does it reproduce? Is there a required condition?
Always (with node 20.11.0 native fetch).
What is the expected behavior? Why is that the expected behavior?
Expected output:
test1
test2
What do you see instead?
Actual output:
test1
Additional information
No response
Metadata
Metadata
Assignees
Labels
abortcontrollerIssues and PRs related to the AbortController APIIssues and PRs related to the AbortController APIfetchIssues and PRs related to the Fetch APIIssues and PRs related to the Fetch API