-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
fix(ext/web): Fix abort signal timeout leak #23842
base: main
Are you sure you want to change the base?
fix(ext/web): Fix abort signal timeout leak #23842
Conversation
#20663 is saying that a test like this should pass. Deno.test({
name: "regression for #20663",
fn: () => {
AbortSignal.timeout(2000);
},
}); |
@@ -120,6 +120,7 @@ class AbortSignal extends EventTarget { | |||
const signal = new AbortSignal(illegalConstructorKey); | |||
signal[timerId] = setTimeout( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that Deno.core offers a queueSystemTimer
to work around this sort of issue. Even with the changes made here, we will still be leaking a timer, as the timer is only ever cleared when the timer has fired (which should have already cleared the timer).
name: "regression for #20663", | ||
fn: async () => { | ||
const signal = AbortSignal.timeout(2000); | ||
const t = setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To properly test this fix, I believe you should create an AbortSignal.timeout and let it just leak out of the test.
Fixes #20663.