RFR: 8293006: sun/tools/jhsdb/JStackStressTest.java fails with "UnalignedAddressException: 8baadbabe"

Chris Plummer cjplummer at openjdk.org
Tue Aug 30 23:37:05 UTC 2022


The root cause of this CR is that we are trying to access the java heap during the middle of a GC. This particular test is prone to that happening since it runs jstack 4 times on the debuggee as it starts up (the debuggee is jshell, so it does a lot of initialization on startup).

SA needs to deal with potentially bad references to java objects. These might come from VM structs (such as the JavaThread reference to its java Thread instance), or a java object reference from a field of another java objects. There's always the possibility that these can be invalid. We work around this in most of our testing by getting the debuggee into a steady state so no GC can be in progress.

For the most part SA is pretty good about dealing with these bad object refernces, and fails gracefully with an exception, but otherwise continues to run. However, this test exposed some holes that resulted in (1) way to many exception stack traces and (2) exiting the SA tool rather than trying to continue.

The main fix is in JavaThread.printThreadInfo() where we now do a better job of dealing with exceptions if any of the java objects references are not valid. Even without access to the Thread instance, we can still produce a stack trace, but it will be missing things like the thread name and priority. This is a lot better than just giving up with the first exception.

The other changes are for the most part just improvements in the error output, and getting rid of the printStackTrace() that was cluttering up the output.

-------------

Commit messages:
 - When dumping the stack, be more cautious with references to java objects that might not be valid due to a GC in progress.

Changes: https://git.openjdk.org/jdk/pull/10088/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10088&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8293006
  Stats: 77 lines in 5 files changed: 38 ins; 0 del; 39 mod
  Patch: https://git.openjdk.org/jdk/pull/10088.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10088/head:pull/10088

PR: https://git.openjdk.org/jdk/pull/10088



More information about the hotspot-gc-dev mailing list