-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
fs: document why isPerformingIO is required #33982
Conversation
@addaleax: PTAL to ensure the description is correct. |
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.
LGTM, minor nits
Co-authored-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com>
@addaleax: Would it make sense to add guards for this one level lower, i.e. in fs.read/write and fs.close? I'm a little worried that when users use these methods directly they don't take this edge case into consideration (just like we missed it in fs streams). |
@ronag Yes, but how? We can’t assign those properties to the |
We could have a Would it be possible to use |
@ronag Yes… I’m just worried we’ll run into problems – what if the user passes the fd to an addon? We can’t know what happens with that fd in that case. I’m all for it, though – I’ve thought about doing this for Worker threads too, at least optionally, because they should really close all fds that they have created during their lifetime. |
Is it maybe possible to fix this whole thing in libuv? It kind of feels like a "bug" to me... |
@ronag I don’t think we could do it any better than in Node.js, i.e. it would have to be on a best-effort basis. |
Would moving to e.g. io_uring on at least linux resolve this? |
Could napi have guards? |
Not that I know of – they still pass
No, we can’t tell fds apart from other integers, unfortunately. (These are all reasons why |
Yes, I think ioring would avoid the need for threads and sync api's... i.e. removing the underlying issue. |
PR-URL: #33982 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Landed in 51a2df4 |
This is not landing cleanly on v14.x. @ronag should we backport? |
@MylesBorins: No I think we can skip this. It's mostly for future reference in development. |
Adds some notes to motivate why isPerformingIO is required for any future developers unfamiliar with it.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes