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

Thomas Stuefe stuefe at openjdk.java.net
Wed Feb 24 15:48:40 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()`.

Hi Brian,

just some curious questions. 

Does your test case always fail to force on Windows, or only intermittently? Since I have not seen these kind of errors in a long while.

About the 3->5: were you able to reproduce it, and had better results with 5 than 3? I found an old issue in mongo and they seem to have done workaround way more aggressively (retry 1mio times or 60 seconds, whatever is faster): 
https://github.com/mongodb/mongo/blob/c0ed1fde6a726909ae99b928a711e3c38837a4ae/src/mongo/util/mmap_win.cpp#L179

Thanks, Thomas

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

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


More information about the nio-dev mailing list