RFR: 8345543: Test serviceability/jvmti/vthread/StopThreadTest/StopThreadTest.java failed: expected JVMTI_ERROR_OPAQUE_FRAME instead of: 0 [v6]
Patricio Chilano Mateo
pchilanomate at openjdk.org
Tue Jan 21 21:40:40 UTC 2025
On Fri, 17 Jan 2025 07:55:19 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> The problem is that the state of the target `vthread` is changed to `BLOCKED` too early. It is done in a constructor of helper object `JavaThreadBlockedOnMonitorEnterState` which sets the state of `vthread` to `JavaThreadStatus::BLOCKED_ON_MONITOR_ENTER`. The `vthread` is getting suspended in `try_preempt()` while calling `JvmtiVTMSTransitionDisabler::start_VTMS_transition()`, so does not become unmounted as it is expected by the failing test. Also, it seems that the base class of the `JavaThreadBlockedOnMonitorEnterState` is supporting just HotSpot `JavaThread`'s and so, it is changing the carrier thread state only.
>>
>> The fix is to move the definition of the `JavaThreadBlockedOnMonitorEnterState` object after block where `try_preempt()` is called.
>>
>> Testing:
>> - Checked the failed test does not fail with the fix: `serviceability/jvmti/vthread/StopThreadTest/StopThreadTest.java`
>> - Ran mach5 tiers 1-6
>
> Serguei Spitsyn has updated the pull request incrementally with one additional commit since the last revision:
>
> review: new function notify_contended_enter must be private
New version looks good to me. I still think it would be good to also fix the platform thread case to not be BLOCKED while posting the event so thanks for filing the follow up bug.
src/hotspot/share/runtime/objectMonitor.cpp line 510:
> 508: freeze_result result;
> 509:
> 510: assert(current->current_pending_monitor() == nullptr, "invariant");
Question on this pre-existent line. So if the callback from monitor_contended_enter calls Java code we might end up here again hitting this assert. In a product build it seems we would eventually hit SOE from recursive calls, I guess that’s the expected behavior?
-------------
Marked as reviewed by pchilanomate (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/23125#pullrequestreview-2565738300
PR Review Comment: https://git.openjdk.org/jdk/pull/23125#discussion_r1924393758
More information about the hotspot-runtime-dev
mailing list