4903717: nsk/jdi/ThreadReference/isSuspended/issuspended002 failing

Reviewed-by: amenkov, sspitsyn
This commit is contained in:
Gary Adams 2019-03-04 08:45:05 -05:00
parent 3d9de2e6f2
commit cf086be753
2 changed files with 64 additions and 43 deletions

View File

@ -157,7 +157,6 @@ vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded004
vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded005/TestDescription.java 8153598 generic-all
vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock001/TestDescription.java 8060733 generic-all
vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002/TestDescription.java 4903717 generic-all
vmTestbase/nsk/jdi/ThreadReference/resume/resume001/TestDescription.java 8072701 generic-all
vmTestbase/nsk/jdi/ThreadReference/stop/stop001/TestDescription.java 7034630 generic-all
vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001/TestDescription.java 8013728 generic-all

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -76,10 +76,8 @@ public class issuspended002a {
IOPipe pipe = argHandler.createDebugeeIOPipe();
pipe.println("ready");
int exitCode = PASSED;
for (int i = 0; ; i++) {
String instruction;
log1("waiting for an instruction from the debugger ...");
@ -97,7 +95,6 @@ public class issuspended002a {
Threadissuspended002a test_thread =
new Threadissuspended002a("testedThread");
log1(" thread2 is created");
label:
synchronized (Threadissuspended002a.lockingObject) {
synchronized (Threadissuspended002a.waitnotifyObj) {
@ -116,7 +113,6 @@ public class issuspended002a {
exitCode = FAILED;
break label;
}
pipe.println("docontinue");
} catch ( Exception e2) {
log1(" Exception e2 exception: " + e2 );
pipe.println("waitnotifyerr");
@ -125,6 +121,26 @@ public class issuspended002a {
}
log1("mainThread is out of: synchronized (lockingObject) {");
// To avoid contention for the logging print stream lock
// the main thread will wait until the debuggee test thread
// has completed to the breakpoint.
// If the debugger suspends the main thread while it is holding
// the logging lock, the test is deadlocked on the test thread log
// calls.
synchronized (Threadissuspended002a.waitnotifyObj) {
try {
// Main debuggee thread is out of synchronized(lockingObject)
// so the test thread will continue.
// Send the debugger the "docontinue" command
// so it will enable the breakpoint in the test thread.
pipe.println("docontinue");
Threadissuspended002a.waitnotifyObj.wait();
} catch (Exception e3) {
pipe.println("waitnotifyerr");
}
}
break ;
//------------------------------------------------- standard end section
@ -135,12 +151,11 @@ public class issuspended002a {
}
} else {
logErr("ERRROR: unexpected instruction: " + instruction);
logErr("ERROR: unexpected instruction: " + instruction);
exitCode = FAILED;
break ;
}
}
System.exit(exitCode + PASS_BASE);
}
}
@ -160,10 +175,12 @@ class Threadissuspended002a extends Thread {
log("method 'run' enter");
synchronized (waitnotifyObj) {
log("entered into block: synchronized (waitnotifyObj)");
waitnotifyObj.notify(); }
waitnotifyObj.notify();
}
log("exited from block: synchronized (waitnotifyObj)");
synchronized (lockingObject) {
log("entered into block: synchronized (lockingObject)"); }
log("entered into block: synchronized (lockingObject)");
}
log("exited from block: synchronized (lockingObject)");
i1++;
i2--;
@ -171,6 +188,11 @@ class Threadissuspended002a extends Thread {
runt1();
log("returned from the method 'runt1'");
log("method 'run' exit");
// Allow the main thread to continue
synchronized (waitnotifyObj) {
waitnotifyObj.notify();
}
return;
}