On Fri, 24 Sep 2021 13:46:13 GMT, Lin Zang <lz...@openjdk.org> wrote:
>> src/hotspot/share/services/heapDumper.cpp line 751: >> >>> 749: static void before_work() { >>> 750: assert(_lock == NULL, "ParDumpWriter lock must be initialized only >>> once"); >>> 751: _lock = new (std::nothrow) PaddedMonitor(Mutex::leaf, >>> "ParallelHProfWriter_lock", Mutex::_safepoint_check_always); >> >> If you change these locks to _safepoint_check_always, you have to acquire >> them without the Mutex::_no_safepoint_check flags so I don't know why you >> don't get that assert. > > I think it may be because this is actually not a JavaThread. So the assert in > `Mutex::check_no_safepoint_state` would pass. > Moreover, I have tried to use `PaddedMonitor(Mutex::nosafepoint, > "ParallelHProfWriter_lock", Mutex::_safepoint_check_never);` here, but the > slowdebug would report errors as you mentioned in JDK-8274245. I agree the flag here and at the place of lock acquiring seems problematic. I will try to see whether I can use `Mutex::_safepoint_check_never` here and get rid of the assert. ------------- PR: https://git.openjdk.java.net/jdk/pull/5681