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

Thomas Stuefe stuefe at openjdk.org
Fri Sep 20 08:31:35 UTC 2024


On Fri, 20 Sep 2024 08:09:53 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.
>
> Simon Tooke has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8340401: test for thread with uninitialized stack

I don't think this is good enough. The setting of stack size can race the setting of stack_base - you could observe stack size set, but stack base still unset.

What I would do instead is:

give us a new function in Thread that, by contract, does not assert but returns NULL (similar to e.g. `Thread::curren_or_null()`):


address stack_base_or_null() const { return _stack_base; }

use this in `vma_touches_thread_stack` to skip NULL base.

Alternatively, in `record_stack_base_and_size`, we need a store store barrier between the two writes, and store stack size first.

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

PR Review: https://git.openjdk.org/jdk/pull/21091#pullrequestreview-2317615786


More information about the hotspot-runtime-dev mailing list