8289709: fatal error: stuck in JvmtiVTMSTransitionDisabler::disable_VTMS_transitions #129
Conversation
👋 Welcome back sspitsyn! A progress list of the required criteria for merging this PR into |
Webrevs
|
@@ -69,7 +69,7 @@ void print_current_time() { | |||
} | |||
|
|||
static | |||
int isTestThread(JNIEnv *jni, jvmtiEnv *jvmti, jthread thr) { | |||
bool isTestThread(JNIEnv *jni, jvmtiEnv *jvmti, jthread thr) { | |||
jvmtiThreadInfo inf; | |||
const char* TEST_THREAD_NAME_BASE = "Test Thread"; | |||
check_jvmti_status(jni, jvmti->GetThreadInfo(thr, &inf), "Error in GetThreadInfo."); |
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.
In passing, should isTestThread deallocate inf.name to avoid leaking memory?
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.
Alan, thank you for looking at this fix.
Good suggestion.
@@ -213,23 +215,25 @@ void JNICALL FramePop(jvmtiEnv *jvmti, JNIEnv *jni, | |||
jthread thr, jmethodID method, jboolean wasPopedByException) { | |||
jint frameCount; | |||
|
|||
RawMonitorLocker rml(jvmti, jni, agent_lock); | |||
if (!isTestThread(jni, jvmti, thr)) { | |||
return; // not a tested thread |
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.
If I read the test correctly, NotifyFramePop will only be called with the test thread so therefore the FramePop callback should only be called by the test thread, is that correct? I'm asking because I'm wondering why FramePop also checks the thread is the test thread.
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.
As I understand, it is kind of a double-check in this test.
I agree, we can simplify this code little bit.
@sspitsyn 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 7 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 ➡️ To integrate this PR with the above commit message to 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.
Looks good
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, assumint
return strncmp(inf.name, TEST_THREAD_NAME_BASE, strlen(TEST_THREAD_NAME_BASE)) == 0; | ||
|
||
bool result = strncmp(inf.name, TEST_THREAD_NAME_BASE, strlen(TEST_THREAD_NAME_BASE)) == 0; | ||
jvmti->Deallocate((unsigned char *)inf.name); |
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.
Optional, we have 'deallocate' method in './jdk/test/lib/jvmti/jvmti_common.h' which check error status.
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.
Leonid, thank you for review. Yes, I know it. But there are other places with Deallocate. I decided to keep it consistent and avoid touching other spots to avoid unnecessary risk.
Alan and Alex, thank you for reviews! |
/integrate |
Going to push as commit c3806b9.
Your commit was automatically rebased without conflicts. |
This is a test bug. The test should filter out non-tested threads to avoid generating such kind of deadlocks.
In short, the deadlock dependencies are:
Common-Cleaner
thread is executing the JVM TI agentMethodEntry
event callback which grabbed theagent_lock
raw monitor and calls JVM TIGetFrameCount
. TheGetFrameCount
is blocked in disabling VTMS transitions because theForkJoinPool-1-worker-2
is at a mount (VTMS) transition.ForkJoinPool-1-worker-2
is at mount (VTMS) transition and blocked injava.lang.ref.NativeReferenceQueue.poll()
when acquiring theNativeReferenceQueue
lock which is held by theReference Handler
thread.Reference Handler
thread grabbed theNativeReferenceQueue
lock and is entering thesignal()
method. It triggered a JVM TIMethodEntry
event. The JVM TI agentMethodEntry
event callback is blocked on grabbing theagent_lock
raw monitor which is held by theCommon-Cleaner
thread.Also, the
timeout=360
is explicitly set to avoid frequent timeouts in locals runs.Testing: submitted mach5 job with 100 runs on 3 debug platforms.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk19 pull/129/head:pull/129
$ git checkout pull/129
Update a local copy of the PR:
$ git checkout pull/129
$ git pull https://git.openjdk.org/jdk19 pull/129/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 129
View PR using the GUI difftool:
$ git pr show -t 129
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk19/pull/129.diff