The problem is that main thread is not always blocked, and when it's not blocked the stack may be in a state that prevents SA from being able to produce a stack trace. So the stack trace for the main method ends up empty, or in very very rare occasions includes an invalid frame with the notation "Compiled frame; information may be imprecise".
These are the test that are affected:
serviceability/sa/ClhsdbCDSJstackPrintAll.java
serviceability/sa/ClhsdbDumpheap
serviceability/sa/ClhsdbFindPC.java
serviceability/sa/ClhsdbJdis.java
serviceability/sa/ClhsdbJstack.java
serviceability/sa/ClhsdbPrintAs.java
serviceability/sa/ClhsdbSource
serviceability/sa/ClhsdbWhere.java
serviceability/sa/sadebugd/DebugdConnectTest.java
sun/tools/jhsdb/HeapDumpTest.java
They can be made to fail much more readily by modifying LingeredApp.main() so it only sleeps for 1ms instead of 1000ms. This way the test is much more apt to request the stack trace when the main thread's stack is in an state that prevents SA from getting the stack trace (or more precisely, getting the current frame).
This bug is the cause of a few outstanding bugs that will be closed as duplicates:
The AIOOBE is due to the test trying to first split the output at the "LingeredApp.main" symbol, and then access String[1] of the result, which doesn't exist since no splitting was done due to "LingeredApp.main" missing from the output.
[Note, the following tests used to be in the above list, but I moved them out since they don't query the LingeredApp "main" thread, nor any other thread that is not stable.]
serviceability/sa/TestJhsdbJstackLock.java
serviceability/sa/TestJhsdbJstackMixed.java
- duplicates
-
JDK-8211923 [Testbug] serviceability/sa/ClhsdbFindPC.java ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
- Closed
-
JDK-8250994 IndexOutOfBoundsException in serviceability/sa/ClhsdbFindPC.java#id0
- Closed
-
JDK-8240781 serviceability/sa/ClhsdbJdis.java fails with "java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1"
- Closed
-
JDK-8242411 serviceability/sa/ClhsdbCDSJstackPrintAll.java fails with Test ERROR java.lang.RuntimeException: 'LingeredApp.main' missing from stdout/stderr
- Closed
- is blocked by
-
JDK-8263326 Remove ReceiverTypeData check from serviceability/sa/TestPrintMdo.java
- Resolved
- relates to
-
JDK-8269881 SA stack dump fails to include stack trace for SteadyStateThread
- Open
-
JDK-8257998 serviceability/sa/ClhsdbJstack.java#id0 fails with 'Signal Dispatcher' missing from stdout/stderr
- Closed
-
JDK-8269522 serviceability/sa tests failed with "ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1"
- Closed
-
JDK-8261929 ClhsdbFindPC fails with java.lang.RuntimeException: 'In java stack' missing from stdout/stderr
- Resolved
-
JDK-8200217 SA: serviceability/sa/ClhsdbJstack.java fails with Test ERROR java.lang.RuntimeException: 'LingeredApp.main' missing from stdout/stderr
- Closed