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
Reviewed-by: lmesnik, cjplummer
  • Loading branch information
Serguei Spitsyn committed Apr 1, 2024
1 parent ecd2b71 commit 70c8ff1
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

3 comments on commit 70c8ff1

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@SoniaZaldana
Copy link
Member

Choose a reason for hiding this comment

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

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 70c8ff1 Aug 19, 2024

Choose a reason for hiding this comment

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

@SoniaZaldana the backport was successfully created on the branch backport-SoniaZaldana-70c8ff1c-master in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 70c8ff1c from the openjdk/jdk repository.

The commit being backported was authored by Serguei Spitsyn on 1 Apr 2024 and was reviewed by Leonid Mesnik and Chris Plummer.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-SoniaZaldana-70c8ff1c-master:backport-SoniaZaldana-70c8ff1c-master
$ git checkout backport-SoniaZaldana-70c8ff1c-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-SoniaZaldana-70c8ff1c-master

Please sign in to comment.