On Fri, 8 Dec 2023 22:29:12 GMT, Alex Menkov <[email protected]> wrote:
> Original fix for JDK-8299426 (Heap dump does not contain virtual Thread stack
> references, #16665) caused failures of new test (added while #16665 was under
> review):
> test/hotspot/jtreg/compiler/c2/TestReduceAllocationAndHeapDump.java in many
> tears and was reverted.
>
> Segmented heap dump assumes "merge" stage is executed outside of safepoint
> (to not block the VM), but heap dump may happen during safepoint (and
> TestReduceAllocationAndHeapDump.java test provoke the case).
> The change contains original fix for JDK-8299426 ("[original
> fix](https://github.com/openjdk/jdk/commit/bdbf768eafa86e0007aca4188e0567693afe9071)")
> and removes asserts from HeapMerger ([allow heapdump in
> safepoints](https://github.com/openjdk/jdk/commit/44670ca4bf55dd2a5f1f44686758844aed68937e)).
>
> Run tier1-3 and heapdump-related tests.
src/hotspot/share/services/heapDumper.cpp line 1984:
> 1982: // user space.
> 1983: void DumpMerger::merge_file(char* path) {
> 1984: assert(!SafepointSynchronize::is_at_safepoint(), "merging happens
> outside safepoint");
This might fix the failure but why is this restriction in place to begin with?
This seems like a very expensive operation to be performing by the VMThread
during a safepoint!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17040#discussion_r1421975329