-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Erlang cannot read nor write files with to 2^31 bytes or more on macOS #6242
Comments
How odd. We have test cases that should cover those scenarios. |
I can't reproduce:
This is on x86_64-pc-linux-gnu, 64-bit everything, glibc, and ext4 file system. |
On macOS I think it is the EINVAL limit for writev and readv that is hit:
In the Linux manual the same text reads:
|
Thanks @mikpe! Can you also try with |
Sorry, I misspoke. The issue happens on macOS only. I have amended the title accordingly. |
I guess it's moot now, but retesting on Linux with s/2147483648/4294967297/g showed no error. |
@mikpe I mean, it was very useful to confirm it does not happen on Linux, because despite my initial claim it was not tested on Linux. :) Thank you! |
On macOS there is an (as far as I can tell) undocumented limitation for read and write that the size is not allowed to be greater than 4GB. So if we get an EINVAL from read/write and the size is > 4GB we try again with a smaller size. Closes erlang#6242
There seems to be an undocumented limitation in write/read for macOS that a single read/write cannot be larger than I've put together a fix in #6248 |
On macOS there is an (as far as I can tell) undocumented limitation for read and write that the size is not allowed to be greater than 4GB. So if we get an EINVAL from read/write and the size is > 4GB we try again with a smaller size. Closes erlang#6242
On macOS there is an (as far as I can tell) undocumented limitation for read and write that the size is not allowed to be greater than 4GB. So if we get an EINVAL from read/write and the size is > 2GB we try again with a smaller size. Closes erlang#6242
On macOS there is an (as far as I can tell) undocumented limitation for read and write that the size is not allowed to be greater than 2GB. So if we get an EINVAL from read/write and the size is > 2GB we try again with a smaller size. Closes erlang#6242
@garazdawi thanks! I have also tried it locally and it worked. :) |
On macOS there is an (as far as I can tell) undocumented limitation for read and write that the size is not allowed to be greater than 2GB. So if we get an EINVAL from read/write and the size is > 2GB we try again with a smaller size. Closes erlang#6242
On macOS there is an (as far as I can tell) undocumented limitation for read and write that the size is not allowed to be greater than 2GB. So if we get an EINVAL from read/write and the size is > 2GB we try again with a smaller size. Closes erlang#6242
The man page changed recently: https://github.com/apple-oss-distributions/xnu/blame/27b03b360a988dfd3dfdf34262bb0042026747cc/bsd/man/man2/write.2#L228 |
Describe the bug
where 2147483648 is 2^31.
I have been told this error does not happen on Windows. It has been reproduced on macOS.
Upon further inspection, it also happens with the file descriptor read/write APIs, even when reading small files. In this case, however, the limit is slightly lower:
Note the Linux manual says:
Although I could only read
2147479552-1
. So perhaps it is generally safer to not try to read more than2147479552-1
bytes in said systems?Expected behavior
That it can read files with 2^31 bytes or more. :)
Affected versions
Checked it on 25 and master as of 23b7b7e.
The text was updated successfully, but these errors were encountered: