Invalid argument exception when trying to seek FilePosition to LONG.MAX_VALUE
Florian Weimer
fweimer at redhat.com
Wed Jun 5 15:31:09 UTC 2019
* Alan Bateman:
> On 04/06/2019 18:13, Karan Mehta wrote:
>
> Hello everyone,
>
> Apache bookkeeper project uses Java NIO to read journal files from disk. Recently a change was made that would seek the file to
> LONG.MAX_VALUE. When we tried running this on a test inside a docker container with openjdk:8-jdk image, it results in
> IOException. The patch fix PR is here. Furthermore, running it inside the same container on different hardware throws IOException
> either while seeking the file to LONG.MAX_VALUE or when reading the file at that value as per the link of the interface here.
> Checkout the comment here. I am suspecting this to be a JNI related issue or bug. Let me know what you all think and if there's
> any better way to figure this out.
>
> I just checked this on macOS and Linux. macOS seems happy with lseek'ing to LONG.MAX_VALUE, Linux does not:
>
> [pid 34168] lseek(4, 9223372036854775807, SEEK_SET) = -1 EINVAL (Invalid argument)
This is with ext4, right? XFS is fine with it and can even write there:
info: maximum writable file offset: 9223372036854775806 (7ffffffffffffffe)
info: writing out of range fails with Invalid argument (22)
Thanks,
Florian
More information about the nio-dev
mailing list