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

UV_USE_IO_URING does not update file handle position #55113

Open
ronag opened this issue Sep 25, 2024 · 9 comments
Open

UV_USE_IO_URING does not update file handle position #55113

ronag opened this issue Sep 25, 2024 · 9 comments
Labels
confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding.

Comments

@ronag
Copy link
Member

ronag commented Sep 25, 2024

I suspect possible regression. Not sure what version but must have been recent:

await stream.promises.pipeline(src, fs.createWriteStream(dstPath))

Will not create a full sized file. I suspect that since createWriteStream doesn't explicitly set position during writes it expects the file handle position to be properly updated, which does not seem to be the case with URING.

@ronag ronag added fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding. labels Sep 25, 2024
@santigimeno
Copy link
Member

santigimeno commented Sep 25, 2024

Yes, ordering in the handling of requests sent to the ring is not guaranteed. So you're right, the offset should be properly set when calling uv_fs_write().

@ronag ronag added the confirmed-bug Issues with confirmed bugs. label Sep 25, 2024
@ronag
Copy link
Member Author

ronag commented Sep 25, 2024

I think we should throw in fs.write if position is not provided while UV_USE_IO_URING is enabled. Do we have any other such instances? net?

@ronag
Copy link
Member Author

ronag commented Sep 25, 2024

@nodejs/tsc I think this is so bad that we should just remove UV_USE_IO_URING until we figure out a way to fix it.

@santigimeno
Copy link
Member

This should not be an issue once v1.49.0, which was just released, is used as it disables the SQPOLL ring by default.

@mcollina
Copy link
Member

Didn't we disable UV_USE_IO_URING by default everywhere?

@ronag
Copy link
Member Author

ronag commented Sep 25, 2024

Didn't we disable UV_USE_IO_URING by default everywhere?

Yes, referring to a security issue. But some users like us enable it without knowing that here be dragons.

@santigimeno
Copy link
Member

santigimeno commented Sep 25, 2024

@ronag wait, I'm not familiar with the internals of the streams. Can those uv_fs_write() ops happen in parallel or sequentially? If the latter, I think it should work.

@ronag
Copy link
Member Author

ronag commented Sep 25, 2024

They are sequential.

@santigimeno
Copy link
Member

Ok, can you share a reproducer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding.
Projects
None yet
Development

No branches or pull requests

3 participants