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

NonBlockingFileIO.read(...) don't error if more than 4 GiB is requested #2591

Open
weissi opened this issue Nov 14, 2023 · 4 comments
Open

Comments

@weissi
Copy link
Member

weissi commented Nov 14, 2023

A ByteBuffer can never hold more than 4 GiB of data. But the NonBlockingFileIO.read(...) functions don't complain if more than that is requested. They should error saying that this request can't be fulfilled.

Likewise the readChunked functions cap out at (IIRC) 2 GiB and don't complain if you request more than 2 GiB chunks.

Both need to error.

So

  • read: Work through 4 GiB, error > 4 GiB
  • readChunked: Work up through 2 GiB, error > 2 GiB (the reason for the 2 GiB limit is that IIRC the underlying posix functions don't work if > CInt.max, this should be checked though).
@dnadoba
Copy link
Member

dnadoba commented Nov 14, 2023

We should also upgrade some of the Int types that express file sizes to Int64 so 4GB+ sizes can actually be supported on 32bit systems. I think this only affects the byteCount parameter of readChunked. This can be done separately and will need to preserver and deprecate the old function signatures. Note that offset is already Int64.

@weissi
Copy link
Member Author

weissi commented Nov 14, 2023

We should also upgrade some of the Int types that express file sizes to Int64 so 4GB+ sizes can actually be supported on 32bit systems. I think this only affects the byteCount parameter of readChunked. This can be done separately and will need to preserver and deprecate the old function signatures. Note that offset is already Int64.

We don't need > 32 bit chunks. Reasonable chunk sizes are in kiB or MiB

@dnadoba
Copy link
Member

dnadoba commented Nov 14, 2023

@weissi
Copy link
Member Author

weissi commented Nov 14, 2023

Agree but I'm talking about the byteCount parameter, not the chunkSize parameter of the readChunked(...) method.

Fair enough!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants