New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8272964: java/nio/file/Files/InterruptCopy.java fails with java.lang.RuntimeException: Copy was not interrupted #5260
Conversation
…RuntimeException: Copy was not interrupted
👋 Welcome back bpb! A progress list of the required criteria for merging this PR into |
Before this PR was created, this test had been run 700 times on each of four different platforms without any failures. |
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) 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. |
My testing showed that if the interrupt is set on the main thread, the copy thread, before the copy actually starts, then the interrupt is missed and the copy runs to completion. As for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that!
@bplb This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 13 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
the solution looks hunky dory, but one question on the call flow in Unix for Files.copy: For the interruptible scenario, an auxiliary thread is used by Cancellable to process the copy. If the "main" thread associated with the Files.copy has yet to reach a call on the actual copy thread t.join when it is interrupted or the interrupt is delivered, then it looks like the interrupt will be missed and the InterruptExcpetion won't be generated. So is there a case for checking the interrupt status of the current thread, in the copy call flow, prior to invoking Cancellable.runInterruptibly, or before t.start for executing the actual copy or before t.join in the runInterruptibly method ? as such increasing the possibility of intercepting the Thread::interrupt in the test? As such, is the test failure not also alluding a potential flaw in the interruptibility of the File.copy? That there is the possibility of an interrupt being delivered prior to the actual invocation of the "real copy" ? |
I tested three scenarios:
In the first two cases an The third case however reveals that if the thread which calls |
/integrate |
Going to push as commit dfeb413.
Your commit was automatically rebased without conflicts. |
Mailing list message from Alan Bateman on nio-dev: On 26/08/2021 21:13, Brian Burkhalter wrote:
I don't immediately see an issue there. A thread can be interrupted at -Alan. |
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.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5260/head:pull/5260
$ git checkout pull/5260
Update a local copy of the PR:
$ git checkout pull/5260
$ git pull https://git.openjdk.java.net/jdk pull/5260/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5260
View PR using the GUI difftool:
$ git pr show -t 5260
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5260.diff