RFR: 8297286: runtime/vthread tests crashing after JDK-8296324 [v8]

Leonid Mesnik lmesnik at openjdk.org
Wed Mar 29 02:43:38 UTC 2023


On Tue, 28 Mar 2023 18:57:23 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> The fix is to enable virtual threads support for late binding JVMTI agents.
>> The fix includes:
>> - New function `JvmtiEnvBase::enable_virtual_threads_notify_jvmti()` which does enabling JVMTI VTMS transition notifications in case of agent loaded into running VM. This function executes a VM operation counting VTMS transition bits in all `JavaThread`'s to correctly set the static counter `_VTMS_transition_count` needed for VTMS transition protocol.
>> - New function `JvmtiEnvBase::disable_virtual_threads_notify_jvmti()` which is needed for testing. It is used by the `WhiteBox` API.
>> - New WhiteBox function `WB_SetVirtualThreadsNotifyJvmtiMode(JNIEnv* env, jobject wb, jboolean enable)` needed for testing of this update.
>> - New regression test: `serviceability/jvmti/vthread/ToggleNotifyJvmtiTest`
>> 
>> Testing:
>> - New test: `serviceability/jvmti/vthread/ToggleNotifyJvmtiTest`
>> - The originally failed tests are expected to pass now:
>>   `runtime/vthread/RedefineClass.java`
>>   `runtime/vthread/TestObjectAllocationSampleEvent.java` 
>> - In progress: Run the tiers 1-6 to make sure there are no regression.
>
> Serguei Spitsyn has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixed trailing spaces in two files

Changes requested by lmesnik (Reviewer).

src/hotspot/share/prims/jvmtiEnvBase.cpp line 1547:

> 1545:       JvmtiThreadState* ct_state = java_lang_Thread::jvmti_thread_state(jt->threadObj());
> 1546:       JvmtiThreadState* vt_state = vt_oop != nullptr ? java_lang_Thread::jvmti_thread_state(vt_oop) : nullptr;
> 1547:       bool virt = vt_oop != nullptr && vt_oop != ct_oop;

You can move it inside if() in line 1554

src/hotspot/share/prims/jvmtiEnvBase.cpp line 1554:

> 1552:       // Correct jt->jvmti_thread_state() and jt->jvmti_vthread() if necessary.
> 1553:       // It was not maintained while notifyJvmti was disabled.
> 1554:       if (jt_state != ct_state && jt_state != vt_state) {

Is it possible that jt_state == ct_state while the virtual thread is executed or vice versa? Just because jvmtt_state is outdated.
Shouldn't we always update (set to null) link/ jvmti_vthread if _enabled  == true?

test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp line 46:

> 44:   RawMonitorLocker agent_locker(jvmti, jni, agent_lock);
> 45: 
> 46:   vthread_started_cnt++;

Wouldn't it be better to use std::atomic<int> instead RawMonitorLocker here to reduce sync time?

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

PR Review: https://git.openjdk.org/jdk/pull/13133#pullrequestreview-1362120493
PR Review Comment: https://git.openjdk.org/jdk/pull/13133#discussion_r1151298663
PR Review Comment: https://git.openjdk.org/jdk/pull/13133#discussion_r1151334153
PR Review Comment: https://git.openjdk.org/jdk/pull/13133#discussion_r1151329179


More information about the serviceability-dev mailing list