Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tdb-alcorn
Copy link

Fixes #20663.

@CLAassistant
Copy link

CLAassistant commented May 16, 2024

CLA assistant check
All committers have signed the CLA.

@0f-0b
Copy link
Contributor

0f-0b commented May 16, 2024

#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(
Copy link
Contributor

@mmastrac mmastrac May 16, 2024

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(() => {
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AbortSignal.timeout() causes Deno.test() to report leaking resources?
4 participants