Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8243455

Many SA tests can fail due to trying to get the stack trace of an active method

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b14

      Description

      There are a number of SA tests that can fail (although only very rarely) due to the expectation of finding the stack trace for the LingeredApp "main" thread in the test output after requesting SA to dump all thread stacks. Usually the test searches for LingeredApp.main in the output, although there are some tests that vary somewhat.

      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:

      JDK-8211923: [Testbug] serviceability/sa/ClhsdbFindPC.java ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
      JDK-8240781: serviceability/sa/ClhsdbJdis.java fails with "java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1"
      JDK-8242411: serviceability/sa/ClhsdbCDSJstackPrintAll.java fails with Test ERROR java.lang.RuntimeException: 'LingeredApp.main' missing from stdout/stderr

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              cjplummer Chris Plummer
              Reporter:
              cjplummer Chris Plummer
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: