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(ops): Always close cancel handles for read_async/write_async #17736

Merged
merged 2 commits into from
Feb 11, 2023
Merged

fix(ops): Always close cancel handles for read_async/write_async #17736

merged 2 commits into from
Feb 11, 2023

Conversation

kamilogorek
Copy link
Contributor

@kamilogorek kamilogorek commented Feb 11, 2023

Fixes #17734

It'd be also possible to fix it inside 40_read_file.js and 40_write_file.js by calling core.tryClose(cancelRid) prior to removing the handler in options.signal[abortSignal.remove](abortHandler), but I think this is te more reasonable place.

I found 3 incorrect tests that I fixed along the way (they used readFile instead of readTextFile.
There's also a naming inconsistency, as readfile and readfile_text are written as joined-words, whereas write_file is separated. Didn't want to touch that here, as not sure what are the implications of such a change in the codebase.

Copy link
Collaborator

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

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

Looks good to me, need to coordinate with the linked PR to not duplicate finishing logics.

cli/tests/unit/read_file_test.ts Show resolved Hide resolved
runtime/ops/fs.rs Show resolved Hide resolved
@aapoalas aapoalas merged commit 0164959 into denoland:main Feb 11, 2023
@kamilogorek kamilogorek deleted the always-close-cancel-handles branch February 11, 2023 12:51
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.

Deno.readTextFile with AbortSignal leaks in tests
2 participants