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
8264663: Update test SuspendWithCurrentThread.java to verify that suspend doesn't exit until resumed #3665
Conversation
…WithCurrentThread.java to verify that suspend don't exit until resumed
|
Thumbs up.
I'm good with the changes. I just a question about the use
of std::atomic
.
#include "jvmti.h" | ||
|
||
extern "C" { | ||
|
||
static jvmtiEnv* jvmti = NULL; | ||
static jthread* threads = NULL; | ||
static jsize threads_count = 0; | ||
static std::atomic<bool> is_exited_from_suspend; |
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.
Is use of std::atomic
permitted in tests?
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've never seen any such restrictions in our development guidelines.
In general, there are cases where using atomic vs raw monitors is desirable to avoid over sync in tests when there is a need to stress multi-threading.
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 don't know anything about such restrictions also. The atomics are required in this test because the thread actually managed to process the suspend request during RawMonitorEnter if it is used and just suspend right before entering the critical section. So RawMonitorEnter/RawMonitorExitt might not show the problem. Also, as Serguei mentioned atomics synchronization might help us in stress tests.
@lmesnik 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 2 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the
|
Hi Leonid,
It looks good to me.
I just wonder if it works on all platforms including Windows.
Thanks,
serguei
Dan, Serguei. Thank you for review. I've verified that test build and passed on linux/win/mac x64 and linux-aarch64. |
/integrate |
@lmesnik Since your change was applied there have been 34 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit b5c6351. |
Test test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/SuspendWithCurrentThread.java
doesn't check that thread stops in SuspendThreadList(...).
Actually, before https://bugs.openjdk.java.net/browse/JDK-8257831 the thread didn't suspend itself but only get a request to be suspended. So it continued to execute and stopped a little bit later.
Such behavior is a violation of spec which says " If the calling thread is specified in the request_list array, this function will not return until some other thread resumes it."
While the bug is fixed it is still useful to verify correct behavior. If the fix is backported without JDK-8257831 test should start failing.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3665/head:pull/3665
$ git checkout pull/3665
Update a local copy of the PR:
$ git checkout pull/3665
$ git pull https://git.openjdk.java.net/jdk pull/3665/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3665
View PR using the GUI difftool:
$ git pr show -t 3665
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3665.diff