RFR: 8272047: java/nio/channels/FileChannel/Transfer2GPlus.java failed with Unexpected transfer size: 2147418112

Naoto Sato naoto at openjdk.java.net
Thu Aug 5 23:29:39 UTC 2021


On Thu, 5 Aug 2021 23:09:27 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> test/jdk/java/nio/channels/FileChannel/Transfer2GPlus.java line 100:
>> 
>>> 98:                             break;
>>> 99:                         total += n;
>>> 100:                     } while (total < LENGTH);
>> 
>> Could it be possible where the `total` is larger than `LINUX_MAX_TRANSFER_SIZE` here after the loop? If so, the test below only checks whether the `dstCh` is smaller than `LENGTH` and proceeds without the error reported.
>
> On Linux the `transferTo()` method uses `sendfile()` for the code in question. The specification of [sendfile()](https://man7.org/linux/man-pages/man2/sendfile.2.html) states that it will transfer at most `0x7ffff000` (`LINUX_MAX_TRANSFER_SIZE`) bytes. So here we are only checking for an aberration which is not essential to the test. The important content is when `transferTo()` is supposed to actually copy the full length in one shot. This Linux part of the test is just a drive-by sanity check.

Thanks for the explanation. Then I would think adding the same check in the loop for consistency, i.e., check the transferred size `n` in one shot is no more than `LINUX_MAX_TRANSFER_SIZE`  after line 98.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5025


More information about the nio-dev mailing list