8290200: com/sun/jdi/InvokeHangTest.java fails with "Debuggee appears to be hung"

Reviewed-by: amenkov, lmesnik, sspitsyn, dcubed
This commit is contained in:
Chris Plummer 2023-03-21 18:00:35 +00:00
parent 019fcd819c
commit 0deb648985
2 changed files with 18 additions and 8 deletions

View File

@ -54,8 +54,6 @@ com/sun/jdi/StepTest.java 8285422 generic-all
com/sun/jdi/redefine/RedefineTest.java 8285422 generic-all
com/sun/jdi/redefineMethod/RedefineTest.java 8285422 generic-all
com/sun/jdi/InvokeHangTest.java 8290200 macosx-x64,windows-x64
####
# JDI SDE Tests
# Use custom classpath

View File

@ -59,11 +59,23 @@ class InvokeHangTarg implements Runnable {
t1.start();
t2.start();
try {
// The join ensures that the test completes before we exit main(). If we are using
// virtual threads, they are always daemon threads, and therefore the JVM will exit
// while they are still running (and the test has not yet completed). The join
// isn't really needed for platform threads, since by default they are not
// daemon threads, but it doesn't hurt any either.
t1.join();
t2.join();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
// This is called from the debugger via invokeMethod
public double invokeee() {
System.out.println("Debuggee: invokeee in thread "+Thread.currentThread().toString());
System.out.println("Debuggee: invokeee in thread " + Thread.currentThread().toString());
Thread.yield();
return longMethod(2);
}
@ -145,9 +157,9 @@ public class InvokeHangTest extends TestScaffold {
List methods = ref.referenceType().methodsByName(methodName);
Method method = (Method) methods.get(0);
try {
System.err.println(" Debugger: Invoking in thread" + thread);
System.out.println(" Debugger: Invoking in thread " + thread);
ref.invokeMethod(thread, method, new ArrayList(), ref.INVOKE_NONVIRTUAL);
System.err.println(" Debugger: Invoke done");
System.out.println(" Debugger: Invoke done");
} catch (Exception ex) {
ex.printStackTrace();
failure("failure: Exception");
@ -191,7 +203,7 @@ public class InvokeHangTest extends TestScaffold {
ThreadReference thread = event.thread();
try {
StackFrame sf = thread.frame(0);
System.err.println(" Debugger: Breakpoint hit at "+sf.location());
System.out.println(" Debugger: Breakpoint hit at " + sf.location());
doInvoke(thread, sf.thisObject(), "invokeee");
} catch (IncompatibleThreadStateException itsex) {
itsex.printStackTrace();
@ -214,7 +226,7 @@ public class InvokeHangTest extends TestScaffold {
targetClass = bpe.location().declaringType();
mainThread = bpe.thread();
EventRequestManager erm = vm().eventRequestManager();
final Thread mainThread = Thread.currentThread();
final Thread mainTestThread = Thread.currentThread();
/*
* Set event requests
@ -246,7 +258,7 @@ public class InvokeHangTest extends TestScaffold {
vmDisconnected = true;
// This awakens the main thread which is
// waiting for a VMDisconnect.
mainThread.interrupt();
mainTestThread.interrupt();
break;
}
myBkpts = bkpts;