On Wed, 17 Sep 2025 21:23:42 GMT, Leonid Mesnik <[email protected]> wrote:

>> The
>> `SuspendResumeManager::suspend(bool register_vthread_SR)`
>> has an issue while suspend current virtual thread. The suspend tries to 
>> access vthread oop field to read vthread id after thread is blocked. 
>> 
>> Seems, that this case is not used by our debugger and was not covered by 
>> tests. I found it using jtreg test thread virtual factory plugin. I updated 
>> existing test to reproduce this problem. The easiest way is to suspend 
>> current virtual thread using plain SuspendThread. 
>> 
>> The fix added some "asymmetry"  in suspend/resume mechanism which is 
>> required because self-suspend doesn't have resume counterpart.
>
> Leonid Mesnik has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   renamed method

src/hotspot/share/runtime/suspendResumeManager.cpp line 84:

> 82: }
> 83: 
> 84: void SuspendResumeManager::set_suspended_current_thread(int64_t 
> vthread_id, bool register_vthread_SR) {

It was totally not at all apparent that `_target` had to be the current thread 
here! Is it always the current thread? Won't this variant only ever get called 
when `register_vthread_SR` would be true - in which case we don't need that 
parameter?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27317#discussion_r2357373281

Reply via email to