RFR: JDK-8316691: Heap dump: separate stack traces for mounted virtual threads [v3]
Serguei Spitsyn
sspitsyn at openjdk.org
Wed Oct 4 01:06:51 UTC 2023
On Fri, 29 Sep 2023 02:20:10 GMT, Alex Menkov <amenkov at openjdk.org> wrote:
>> This is subtask of JDK-8299426: Heap dump does not contain virtual Thread stack references
>> The change:
>> - reorganize thread-related code/prepare it to use for unmounted vthreads:
>> - new ThreadDumper class caches stack frames, thread serial num, frame serial number (trace serial number is calculated from thread serial);
>> ThreadDumper objects for all platform/carrier and mounted virtual threads are cached instead of ThreadStackTrace objects (they are created during HPROF_FRAME/HPROF_TRACE dumping, used lated for writing HPROF_GC_ROOT_THREAD_OBJ/HPROF_GC_ROOT_JAVA_FRAME/HPROF_GC_ROOT_JNI_LOCAL subrecords);
>> - new helper class JavaStackRefDumper to dump references from threadf stack;
>> - separate track traces for mounted virtual threads:
>> - separate HPROF_FRAME/HPROF_TRACE records for mounted vthreads and carrier threads;
>> - separate HPROF_GC_ROOT_THREAD_OBJ/HPROF_GC_ROOT_JAVA_FRAME/HPROF_GC_ROOT_JNI_LOCAL subrecords;
>> - updated hprof parser test lib to collect data about threads (HPROF_GC_ROOT_THREAD_OBJ subrecords) and corresponding stack traces and stack references.
>>
>> Testing - tier1-tier3, new test
>>
>> Output of the test for VtreadInHeapDumpTarg$VthreadMounted thread
>> without the fix:
>> `thread 0x8101be90, 16 frames
>> - [0] VtreadInHeapDumpTarg$VthreadMounted.run()V (VtreadInHeapDump.java:127)
>> Java Local Reference: VtreadInHeapDumpTarg$VthreadMounted
>> Java Local Reference: VtreadInHeapDumpTarg$VThreadMountedReferenced
>> - [1] java.lang.Thread.runWith(Ljava/lang/Object;Ljava/lang/Runnable;)V (Thread.java:1583)
>> Java Local Reference: java.lang.VirtualThread
>> Java Local Reference: java.lang.Class
>> Java Local Reference: VtreadInHeapDumpTarg$VthreadMounted
>> - [2] java.lang.VirtualThread.run(Ljava/lang/Runnable;)V (VirtualThread.java:309)
>> Java Local Reference: java.lang.VirtualThread
>> Java Local Reference: VtreadInHeapDumpTarg$VthreadMounted
>> Java Local Reference: java.lang.Class
>> - [3] java.lang.VirtualThread$VThreadContinuation$1.run()V (VirtualThread.java:190)
>> Java Local Reference: java.lang.VirtualThread$VThreadContinuation$1
>> - [4] jdk.internal.vm.Continuation.enter0()V (Continuation.java:320)
>> Java Local Reference: java.lang.VirtualThread$VThreadContinuation
>> - [5] jdk.internal.vm.Continuation.enter(Ljdk/internal/vm/Continuation;Z)V (Continuation.java:312)
>> Java Local Reference: java.lang.VirtualThread$VThreadContinuation
>> - [6] jd...
>
> Alex Menkov has updated the pull request incrementally with one additional commit since the last revision:
>
> misspell getRefererId for consistency
src/hotspot/share/services/heapDumper.cpp line 1559:
> 1557: // Dumps a HPROF_GC_ROOT_JAVA_FRAME subrecord for each local
> 1558: // Dumps a HPROF_GC_ROOT_JNI_LOCAL subrecord for each JNI local
> 1559: // Returns the number of Java frames in this thread stack
Q: Is this line of comment just wrong and a leftover from an old version of the fix? Function does not return anything, right?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15869#discussion_r1345032171
More information about the serviceability-dev
mailing list