-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8310551: vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java timed out due to missing prompt #14817
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
Conversation
👋 Welcome back cjplummer! A progress list of the required criteria for merging this PR into |
@plummercj The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
…ed to refetch the notInterrupted count.
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.
Yes that look like a more normal sync/wait/notify block.
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.
Looks good.
Thanks,
Serguei
@plummercj 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 46 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 |
…ry for notInterrupted to be atomic.
@@ -83,7 +83,7 @@ static void breakHere () {} | |||
private JdbArgumentHandler argumentHandler; | |||
private Log log; | |||
|
|||
public static final AtomicInteger notInterrupted = new AtomicInteger(numThreads); | |||
public static volatile int notInterrupted = numThreads; |
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.
Nit: If always accessed under lock this does not need to be volatile.
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.
It's also read outside the lock by the debugger side of the test using JDI -> JDWP -> JVMTI. My guess is there is so much other synchronization going on that it probably doesn't need volatile, but technically I think it should have it.
while (notInterrupted.get() > 0 && System.currentTimeMillis() - startTime <= waitTime) { | ||
synchronized (waitnotify) { | ||
synchronized (waitnotify) { | ||
while (notInterrupted > 0 && System.currentTimeMillis() - startTime <= waitTime) { |
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.
@plummercj I'd use a monotonic clock like System.nanoTime()
for things like this since the system clock can be changed to anything at any time.
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'd use a monotonic clock like
System.nanoTime()
for things like this since the system clock can be changed to anything at any time.
We have 100's of uses of System.currentTimeMillis()
in our tests. I think changing them should be handled by a separate effort.
@kevinjwalls and @sspitsyn can you please review the latest changes. Thanks! |
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.
The latest simplification looks good.
Thanks,
Serguei
Thanks Serguei and Kevin! /integrate |
Going to push as commit c84866a.
Your commit was automatically rebased without conflicts. |
@plummercj Pushed as commit c84866a. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
After JDK-8308232, both the test and the debuggee shared the same waittime of 5 minutes. The test would wait up to 5 minutes for the expected prompt, but the debuggee would also in some cases wait 5 minutes before generating the prompt, which sometimes was just a bit too late. Before JDK-8308232, the debuggee would wait at most 2 minutes before generating the prompt, so it was always generated in time.
The main issue is that after the while loop checks that there are still uninterrupted threads remaining, the last of the threads is interrupted before the wait() call is made. This means wait() won't return until it times out, and by then it is too late, and the test side has already timed out waiting for the prompt.
The fix is to widen the synchronized block so the count of not interrupted threads remains correct until
wait()
is entered. The other choice was to refetch the count after entering the synchronized block, which is what I did for the initial fix, but widening seems a better choice so no refetch is needed.For details see https://bugs.openjdk.org/browse/JDK-8310551?focusedCommentId=14594838&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14594838
Tested with 300 runs each on linux-x64 and linux-aarch64 with -Xcomp options that reproduced the issue, and then again with no options.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14817/head:pull/14817
$ git checkout pull/14817
Update a local copy of the PR:
$ git checkout pull/14817
$ git pull https://git.openjdk.org/jdk.git pull/14817/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 14817
View PR using the GUI difftool:
$ git pr show -t 14817
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14817.diff
Webrev
Link to Webrev Comment