RFR: 8296324: JVMTI GetStackTrace truncates vthread stack trace for agents loaded into running VM [v2]
Chris Plummer
cjplummer at openjdk.org
Thu Nov 17 18:46:24 UTC 2022
On Thu, 17 Nov 2022 17:35:32 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> The `VirtualThread` static field `notifyJvmtiEvents` is not set correctly in cases JVMTI agents are loaded into running VM. It is because an extra call to java_lang_VirtualThread::init_static_notify_jvmti_events() is needed.
>> This function is called once at the VM initialization, so this extra call is not necessary for agent loaded at startup.
>>
>> Testing:
>> New test is added: `test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest`
>> This test is failed without fix and passed with it.
>> TBD: run all JVMTI and JDI test in mach5.
>
> Serguei Spitsyn has updated the pull request incrementally with one additional commit since the last revision:
>
> add @requires vm.jvmti to VirtualStackTraceTest
Changes requested by cjplummer (Reviewer).
src/hotspot/share/prims/jvmtiExport.cpp line 385:
> 383: if (Continuations::enabled()) {
> 384: // Virtual threads support. There is a performance impact when VTMS transitions are enabled.
> 385: if (!java_lang_VirtualThread ::notify_jvmti_events()) {
remove extra space before ::
src/hotspot/share/prims/jvmtiExport.cpp line 390:
> 388: ThreadInVMfromNative tiv(JavaThread::current());
> 389: java_lang_VirtualThread::init_static_notify_jvmti_events();
> 390: }
Doesn't this logic mean that if the first pass through this code is made with an unattached thread, then that will prevent subsequent passes from calling `init_static_notify_jvmti_events`, even if the thread is attached. The reason is because `java_lang_VirtualThread::set_notify_jvmti_events(true);` will already have been done, so you won't pass the `if (!java_lang_VirtualThread ::notify_jvmti_events())` check.
-------------
PR: https://git.openjdk.org/jdk/pull/11204
More information about the hotspot-dev
mailing list