RFR: 6539707: (fc) MappedByteBuffer.force() method throws an IOException in a very simple test

Alan Bateman alanb at openjdk.java.net
Fri Feb 19 09:10:43 UTC 2021


On Fri, 19 Feb 2021 00:34:24 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> This change proposes to increase the number of retries of `FlushViewOfFile` in the Windows native implementation of `MappedByteBuffer.force()`, and to catch any exception thrown by the native `force()` and rethrow an `UncheckedIOException` with cause set to the intercepted exception. A sentence is added to the specification of `MappedByteBuffer.force()` regarding unspecified errors. The test from the issue description is revised to fail if `force()` throws an exception which is not an `UncheckedIOException`, or if it is an `UncheckedIOException` whose message indicates it was thrown by the Windows native implementation of `force()`.

src/java.base/windows/native/libnio/MappedMemoryUtils.c line 79:

> 77:             break;
> 78:         retry++;
> 79:     } while (retry < 5);

This retry is a workaround for what we think is a bug in Windows. I remember there was speculation that it was something to do with the NTFS transaction log being full. It would be useful if get a comment from someone from Microsoft on this.

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

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


More information about the nio-dev mailing list