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

Nonsense UNKNOWN error when writing large buffers with fs.writev #40779

Open
zbjornson opened this issue Nov 10, 2021 · 0 comments
Open

Nonsense UNKNOWN error when writing large buffers with fs.writev #40779

zbjornson opened this issue Nov 10, 2021 · 0 comments
Labels
fs Issues and PRs related to the fs subsystem / file system.

Comments

@zbjornson
Copy link
Contributor

Version

14.18.1

Platform

Linux ops 5.11.0-1021-gcp #23~20.04.1-Ubuntu SMP Fri Oct 1 19:04:32 UTC 2021 x86_64 x86_64 x86_64 GNU/Linu

Subsystem

fs

What steps will reproduce the bug?

const fs = require("fs");
const fd = fs.openSync("./test.dat", fs.constants.O_WRONLY | fs.constants.O_CREAT, 0o666);
const bufs = [Buffer.alloc(0x7FFFFFFF + 1)];
fs.writevSync(fd, bufs, 0);

This throws

Uncaught Error: UNKNOWN: unknown error, write
    at Object.writevSync (fs.js:749:3) {
  errno: -2147483648,
  syscall: 'write',
  code: 'UNKNOWN'
}

That errno is 0x7fffffff + 1 wrapped around.

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior?

Should either work, since pwritev(2) works (I don't know if it has a limit less than SSIZE_MAX), or report a proper error before making the syscall. I did the latter recently for fs.write in c4e7dca. It would be nice if large files actually worked, but the best fix for that would require a new libuv function.

What do you see instead?

No response

Additional information

No response

@VoltrexKeyva VoltrexKeyva added the fs Issues and PRs related to the fs subsystem / file system. label Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

No branches or pull requests

2 participants