RFR: 8272964: java/nio/file/Files/InterruptCopy.java fails with java.lang.RuntimeException: Copy was not interrupted
Mark Sheppard
msheppar at openjdk.java.net
Thu Aug 26 00:56:27 UTC 2021
On Wed, 25 Aug 2021 23:37:50 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> In the interrupt case, if the copy does not throw an `IOException`, rather than using the copy duration versus a threshold as the criterion for failure, instead check whether the target file does **not** exist, and if it does not, then make the test fail as this would indicate that the copy was in fact interrupted but did not throw an exception in response.
That's look like a good approach, because the duration threshold test is always subject to the load and the number of extant threads in the test system ... for recent failures the number of threads is significant (> 1000)
Also, when following the copy calls flows there is significant amount of processing prior to the actual copy activity taking place and that occurs in Cancellable in a newly launched "copying thread". What happens if the copy thread has yet to run?
Additionally, would it be useful for the copy interrupter thread to check for the existence of the target file, prior to invoking the interrupt
e.g.
while (Files.notExist(target))
Thread.sleep(...);
-------------
PR: https://git.openjdk.java.net/jdk/pull/5260
More information about the nio-dev
mailing list