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

Thomas Stuefe stuefe at openjdk.org
Fri Sep 20 07:53:28 UTC 2024


On Fri, 20 Sep 2024 02:07:51 GMT, David Holmes <dholmes 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.

I would prefer it here, or in HANDLE_THREAD macro, to make sure we do this for all threads printed.

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

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


More information about the hotspot-runtime-dev mailing list