The following test failed in the JDK17 CI:
runtime/Thread/SuspendAtExit.java
Here's a snippet from the log file:
#section:main
----------messages:(4/384)----------
command: main -agentlib:SuspendAtExit -XX:+UnlockDiagnosticVMOptions -XX:GuaranteedSafepointInterval=1 -XX:+HandshakeALot SuspendAtExit
reason: User specified action: run main/othervm/native -agentlib:SuspendAtExit -XX:+UnlockDiagnosticVMOptions -XX:GuaranteedSafepointInterval=1 -XX:+HandshakeALot SuspendAtExit
Mode: othervm [/othervm specified]
elapsed time (seconds): 22.147
----------configuration:(0/0)----------
----------System.out:(6/114)----------
Agent_OnLoad started
Agent_OnLoad finished
Loaded library: SuspendAtExit
About to execute for 30 seconds.
----------System.err:(13/957)----------
java.lang.RuntimeException: thread Thread-51218: is not alive after successful suspendThread().
at SuspendAtExit.main(SuspendAtExit.java:113)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
at java.base/java.lang.Thread.run(Thread.java:831)
JavaTest Message: Test threw exception: java.lang.RuntimeException: thread Thread-51218: is not alive after successful suspendThread().
JavaTest Message: shutting down test
STATUS:Failed.`main' threw exception: java.lang.RuntimeException: thread Thread-51218: is not alive after successful suspendThread().
----------rerun:(41/5011)*----------
Here's the falling code in the test:
while (true) {
retCode = suspendThread(thread);
if (retCode == JVMTI_ERROR_THREAD_NOT_ALIVE) {
// Done with SuspendThread() calls since
// thread is not alive.
break;
} else if (retCode != 0) {
throw new RuntimeException("thread " + thread.getName()
+ ": suspendThread() " +
"retCode=" + retCode +
": unexpected value.");
}
if (!thread.isAlive()) {
throw new RuntimeException("thread " + thread.getName()
+ ": is not alive " +
"after successful " +
"suspendThread().");
The suspendThread() call worked, but the
java.lang.Thread.isAlive() API returns false.
[~rehn] - looks like we have a new race condition.
runtime/Thread/SuspendAtExit.java
Here's a snippet from the log file:
#section:main
----------messages:(4/384)----------
command: main -agentlib:SuspendAtExit -XX:+UnlockDiagnosticVMOptions -XX:GuaranteedSafepointInterval=1 -XX:+HandshakeALot SuspendAtExit
reason: User specified action: run main/othervm/native -agentlib:SuspendAtExit -XX:+UnlockDiagnosticVMOptions -XX:GuaranteedSafepointInterval=1 -XX:+HandshakeALot SuspendAtExit
Mode: othervm [/othervm specified]
elapsed time (seconds): 22.147
----------configuration:(0/0)----------
----------System.out:(6/114)----------
Agent_OnLoad started
Agent_OnLoad finished
Loaded library: SuspendAtExit
About to execute for 30 seconds.
----------System.err:(13/957)----------
java.lang.RuntimeException: thread Thread-51218: is not alive after successful suspendThread().
at SuspendAtExit.main(SuspendAtExit.java:113)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
at java.base/java.lang.Thread.run(Thread.java:831)
JavaTest Message: Test threw exception: java.lang.RuntimeException: thread Thread-51218: is not alive after successful suspendThread().
JavaTest Message: shutting down test
STATUS:Failed.`main' threw exception: java.lang.RuntimeException: thread Thread-51218: is not alive after successful suspendThread().
----------rerun:(41/5011)*----------
Here's the falling code in the test:
while (true) {
retCode = suspendThread(thread);
if (retCode == JVMTI_ERROR_THREAD_NOT_ALIVE) {
// Done with SuspendThread() calls since
// thread is not alive.
break;
} else if (retCode != 0) {
throw new RuntimeException("thread " + thread.getName()
+ ": suspendThread() " +
"retCode=" + retCode +
": unexpected value.");
}
if (!thread.isAlive()) {
throw new RuntimeException("thread " + thread.getName()
+ ": is not alive " +
"after successful " +
"suspendThread().");
The suspendThread() call worked, but the
java.lang.Thread.isAlive() API returns false.
[~rehn] - looks like we have a new race condition.