-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AbortSignal.any() leaks when any of the provided signal is long-lived #55351
Comments
Hm, the memory is being allocated just for refs - potentially pointing to nothing? Something like this would work? const finalizers = new SafeFinalizationRegistry((signal) => {
signal[kDependantSignals].forEach(ref => {
if (!ref.deref()) {
signal[kDependantSignals].delete(ref);
}
});
}); Then in the loop having this // ...
for (let i = 0; i < signalsArray.length; i++) {
const signal = signalsArray[I];
finalizers.register(resultSignal, signal);
// ... Executing this repro after this (maybe naive?) change
|
Ref: chromium/chromium@d5b7539 - I think it would be the "settled" case(?) |
Is anyone working on this issue? |
Can confirm that we have a problem on this, however, it is not |
I have a pr opened to address this issue. |
So if I want to work on this issue do I need to contact someone or I can start working right away? |
@siddhant0410 The PR here #55354 by @geeksilva97 already fixes this issue, so there's nothing else to do here but wait for the PR to be merged and backported. |
Thanks for the update! |
Version
v22.9.0
Platform
Subsystem
No response
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
AbortSignal.any should not case memory leaks
What do you see instead?
Additional information
It's pretty clear that
AbortSignal.any
attaches the combined signal to all its parent signals. But it only gets removed if the parent signals are actually aborted. If there is a long living signal among the parents, for instance something like a SIGINT handler, then it keeps accumulating WeakRefs to no longer existingAbortSignal
s.Related issues:
AbortSignal
returned byAbortSignal.any
The text was updated successfully, but these errors were encountered: