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
8265240: runtime/Thread/SuspendAtExit.java needs updating #3576
Conversation
/label add hotspot-runtime |
|
/label add serviceability |
@dcubed-ojdk |
@dcubed-ojdk |
@dcubed-ojdk This change now passes all automated pre-integration checks. 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 98 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.
|
Oops. Forgot to mark it ready for review. |
Webrevs
|
Hi Dan,
A few nits (mostly pre-existing) but otherwise the conversion to JVMTI looks good.
Thanks,
David
long start_time = System.currentTimeMillis(); | ||
while (System.currentTimeMillis() < start_time + (timeMax * 1000)) { | ||
count++; | ||
SuspendAtExit threads[] = new SuspendAtExit[N_THREADS]; |
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.
Style nit pre-existing: The [] go on the type not the variable.
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.
Good catch!
As I'm re-reading this code, it occurs to me that I really don't need to
create the array of N_THREADS
any more since we are now time
based and we'll create a new Thread in each loop and run it through
the gauntlet until times runs out.
What do you think about changing SuspendAtExit[N_THREADS]
into just a single SuspendAtExit
?
if (threads[i].isAlive()) { | ||
throw new RuntimeException("Expected !Thread.isAlive() " + | ||
"after thread #" + i + | ||
" has been join()'ed"); | ||
} |
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.
This is unnecessary, you aren't testing the correctness of Thread.join() here. join() can't return normally if the thread is alive.
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.
Okay. Will delete the "late" isAlive() check.
// This interrupt() call will break the worker out of | ||
// the exitSyncObj.await() call and the SuspendThread() | ||
// calls will come in during thread exit. | ||
threads[i].interrupt(); |
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.
Pre-existing: why use interrupt() instead of simply calling countDown() on the latch ??
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.
Hmmm.... I don't remember why I chose to use Thread.interrupt() instead
of countDown() when I created these tests for the Thread-SMR project.
I'll try switching.
@@ -0,0 +1,73 @@ | |||
/* | |||
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. |
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.
Copyright year should just be 2021.
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 copied this code from another file that is "Copyright (c) 2001, 2021"
and renamed just the prefix for the suspendThread() and resumeThread()
functions. Agent_OnLoad() is a straight copy.
So I think I should keep the copyright as is.
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.
Okay. I have no idea what is supposed to happen in such cases.
final static int N_LATE_CALLS = 10000; | ||
private final static String AGENT_LIB = "SuspendAtExit"; | ||
private final static int DEF_TIME_MAX = 30; // default max # secs to test | ||
private final static int N_THREADS = 32; |
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.
N_THREADS is unused now.
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.
Meant to delete that! Will fix it.
I managed to lose my review comment when switching between commits :) so I'll add it here. Updates look good. I agree there is no need for the Thread[] any more. Thanks, |
/integrate |
@dcubed-ojdk Since your change was applied there have been 107 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit c9b70c8. |
I'm updating the runtime/Thread/SuspendAtExit.java test:
I've used this test to stress @robehn's fix for JDK-8257831 using both
invocation styles for 9 hours each in {fastdebug, release, slowdebug}
configs without any issues.
I've run the updated test thru Mach5 Tier[134567] testing; one timeout
was observed in a single Tier6 run on Win-X64. I believe this is a case of
a lost Thread.interrupt() call.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3576/head:pull/3576
$ git checkout pull/3576
Update a local copy of the PR:
$ git checkout pull/3576
$ git pull https://git.openjdk.java.net/jdk pull/3576/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3576
View PR using the GUI difftool:
$ git pr show -t 3576
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3576.diff