On Fri, 22 Dec 2023 01:43:07 GMT, Alex Menkov <amen...@openjdk.org> wrote:

>> HeapDumper dumps virtual threads in 2 places:
>> - dumping platform threads (mounted virtual threads are dumped as separate 
>> thread object);
>> - dumping heap objects when the object is `java.lang.VirtualThread`.
>> 
>> In the 2nd case mounted virtual threads should be skipped (as they are 
>> already dumped with correct stack traces/stack references)
>> Check that a virtual thread is mounted is non-trivial, method from 
>> JvmtiEnvBase was used for this.
>> 
>> Testing: tier1..3, heapdump-related tests: 
>> open/test/hotspot/jtreg/serviceability,open/test/hotspot/jtreg/runtime/ErrorHandling,open/test/hotspot/jtreg/gc/epsilon,open/test/jdk/sun/tools/jhsdb
>
> Alex Menkov has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   feedback: comment added

The fix looks good. Thank you for the update.
Also, added a minor comment.

src/hotspot/share/services/heapDumper.cpp line 1934:

> 1932:     // create a HPROF_GC_INSTANCE record for each object
> 1933:     DumperSupport::dump_instance(writer(), o, &_class_cache);
> 1934:     // If we encounter an unmounted virtual thread it needs to be 
> dumped explicitly.

Nit: It is nice to have a comment here.
I'm thinking if it'd make sens to shortly explain why mounted threads are not 
dumped here.

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

Marked as reviewed by sspitsyn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17134#pullrequestreview-1794318747
PR Review Comment: https://git.openjdk.org/jdk/pull/17134#discussion_r1434952089

Reply via email to