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

Alan Bateman alanb at openjdk.java.net
Wed Feb 24 16:02:41 UTC 2021


On Wed, 24 Feb 2021 15:46:02 GMT, Thomas Stuefe <stuefe 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

I put in the retry loop several years ago as a workaround to what we thought at the time was a Windows bug. It was very intermittent and seem to be load related. I suspect this issue really needs someone from the Windows team to comment.

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

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


More information about the nio-dev mailing list