Skip to content

Commit

Permalink
8328665: serviceability/jvmti/vthread/PopFrameTest failed with a timeout
Browse files Browse the repository at this point in the history
Backport-of: 70c8ff1c9a9adf21a16d8a6b4da1eeec65afe61d
  • Loading branch information
GoeLin committed Sep 13, 2024
1 parent 29b65ab commit 5162660
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread,
{
RawMonitorLocker rml(jvmti, jni, monitor);
bp_sync_reached = true;
rml.wait(0);
while (bp_sync_reached) { // guard against spurious wakeups
rml.wait(0);
}
}
LOG("Breakpoint: In method TestTask.B(): after sync section\n");

if (do_pop_frame != 0) {
if (do_pop_frame) {
err = jvmti->PopFrame(thread);
LOG("Breakpoint: PopFrame returned code: %s (%d)\n", TranslateError(err), err);
check_jvmti_status(jni, err, "Breakpoint: Failed in PopFrame");
Expand Down Expand Up @@ -152,20 +154,25 @@ Java_PopFrameTest_popFrame(JNIEnv *jni, jclass cls, jthread thread) {

JNIEXPORT void JNICALL
Java_PopFrameTest_ensureAtBreakpoint(JNIEnv *jni, jclass cls) {
bool need_stop = false;

LOG("Main: ensureAtBreakpoint\n");
while (!need_stop) {
RawMonitorLocker rml(jvmti, jni, monitor);
need_stop = bp_sync_reached;
sleep_ms(1); // 1 millisecond
RawMonitorLocker rml(jvmti, jni, monitor);
int attempts = 0;
while (!bp_sync_reached) {
if (++attempts > 100) {
fatal(jni, "Main: ensureAtBreakpoint: waited 20 sec");
}
LOG("Main: ensureAtBreakpoint: waiting 200 millis\n");
rml.wait(200); // 200 milliseconds
}
}

JNIEXPORT void JNICALL
Java_PopFrameTest_notifyAtBreakpoint(JNIEnv *jni, jclass cls) {
LOG("Main: notifyAtBreakpoint\n");
RawMonitorLocker rml(jvmti, jni, monitor);
if (!bp_sync_reached) { // better diagnosability
fatal(jni, "Main: notifyAtBreakpoint: expected: bp_sync_reached==true");
}
bp_sync_reached = false;
rml.notify_all();
}
Expand Down

1 comment on commit 5162660

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.