RFR: 8340401: DcmdMBeanPermissionsTest.java and SystemDumpMapTest.java fail with assert(_stack_base != nullptr) failed: Sanity check

David Holmes dholmes at openjdk.org
Fri Sep 20 07:53:27 UTC 2024


On Thu, 19 Sep 2024 14:51:01 GMT, Simon Tooke <stooke at openjdk.org> wrote:

> This PR addresses JDK-8340401 by adding a test for a thread with no stack currently assigned.

src/hotspot/share/nmt/memMapPrinter.cpp line 176:

> 174:   // Therefore we go for the simplest way here and check for intersection between VMA and thread stack.
> 175:   // If the stack size is zero (i.e. no stack assigned yet), then return false.
> 176:   if (t->stack_size() == 0) return false;

I think this should go in the iteration loop:

  for (JavaThreadIteratorWithHandle jtiwh; JavaThread* t = jtiwh.next(); ) {
    // We can encounter new threads whose stack has not yet been initialized - so skip them
    if (t->stack_size() == 0) continue;
    HANDLE_THREAD(t);
  }

or even

  for (JavaThreadIteratorWithHandle jtiwh; JavaThread* t = jtiwh.next(); ) {
    // We can encounter new threads whose stack has not yet been initialized - so skip them in debug to avoid assertion
    DEBUG_ONLY(if (t->stack_size() == 0) continue;)
    HANDLE_THREAD(t);
  }

this assumes `range_intersects` will correctly handle a zero base and end in a release build.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21091#discussion_r1767823477


More information about the hotspot-runtime-dev mailing list