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 AbortSignal.timeout() leak #23842

Merged
merged 7 commits into from
Jun 18, 2024

Conversation

tdb-alcorn
Copy link
Contributor

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.

@iuioiua iuioiua changed the title fix(ext/web): Fix abort signal timeout leak fix(ext/web): fix AbortSignal.timeout() leak Jun 18, 2024
@iuioiua iuioiua requested a review from littledivy June 18, 2024 20:44
@iuioiua
Copy link
Contributor

iuioiua commented Jun 18, 2024

Thanks for the deno_core fix, @littledivy! And thank you, @tdb-alcorn for addressing this.

@iuioiua iuioiua merged commit 5289c69 into denoland:main Jun 18, 2024
17 checks passed
Comment on lines 372 to 373
[patch.crates-io]
deno_core = { git = "https://github.com/denoland/deno_core" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this before merging. My mistake.

bartlomieju added a commit that referenced this pull request Jun 18, 2024
A PR was landed by mistake that used `[patch.crates-io]` instead
of released `deno_core` version:
#23842 (comment)
bartlomieju pushed a commit that referenced this pull request Jun 18, 2024
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->

Fixes #20663.

---------

Co-authored-by: Asher Gomez <[email protected]>
Co-authored-by: Divy Srivastava <[email protected]>
bartlomieju added a commit that referenced this pull request Jun 18, 2024
A PR was landed by mistake that used `[patch.crates-io]` instead
of released `deno_core` version:
#23842 (comment)
zebreus pushed a commit to zebreus/deno that referenced this pull request Jul 8, 2024
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix denoland#7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->

Fixes denoland#20663.

---------

Co-authored-by: Asher Gomez <[email protected]>
Co-authored-by: Divy Srivastava <[email protected]>
zebreus pushed a commit to zebreus/deno that referenced this pull request Jul 8, 2024
A PR was landed by mistake that used `[patch.crates-io]` instead
of released `deno_core` version:
denoland#23842 (comment)
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?
6 participants