fs: document why isPerformingIO is required#33982
fs: document why isPerformingIO is required#33982ronag wants to merge 2 commits intonodejs:masterfrom
Conversation
|
@addaleax: PTAL to ensure the description is correct. |
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