On Thu, 20 Aug 2026 20:35:20 GMT, Chris Plummer <[email protected]> wrote:

>> Allow OpaqueFrameException for vthreads when suspended in a loop (not at an 
>> event). This became necessary after 
>> [JDK-8386116](https://bugs.openjdk.org/browse/JDK-8386116). The 
>> ThreadReference.stop() spec allows for this:
>> 
>> `This method may be used to send an asynchronous exception to a virtual 
>> thread when it is suspended at an event. An implementation may support 
>> sending an asynchronous exception to a suspended virtual thread in other 
>> cases.`
>> 
>> and
>> 
>> `OpaqueFrameException - if the thread is a suspended virtual thread and the 
>> implementation was unable to throw an asynchronous exception from the 
>> thread's current frame`
>> 
>> I also field [JDK-8390483](https://bugs.openjdk.org/browse/JDK-8390483) to 
>> investigate if JVMTI should remove all vthread support for StopThread when 
>> not at an event rather than having work just some of the time.
>> 
>> The failure used to happen about 1 out of 50 runs. Tested with both platform 
>> threads and with virtual threads about 200 times each with no issues.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Chris Plummer has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - clean up comment
>  - fix missing failure result

Marked as reviewed by sspitsyn (Reviewer).

This looks good. I've posted a couple of nits though.

test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop002.java line 70:

> 68:     static final String DEBUGGEE_STOP_LOOP2_FIELD = "stopLooping2";
> 69:     // debuggee field used to indicate that debugger got 
> OpaqueFrameException
> 70:     static final String DEBUGGEE_GOT_OPE_FIELD = 
> "gotOpaqueFrameException";

Nit: Why `DEBUGGEE_GOT_OPE_FIELD` ? Should it be `DEBUGGEE_GOT_OFE_FIELD` ? It 
is kind of confusing.

test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop002.java line 
239:

> 237:                 } else {
> 238:                     ofe.printStackTrace();
> 239:                     log.complain("TEST #4 FAILED: caught unexpected " + 
> ofe);

Nit: Should this message also say the `OFE` is not expected in the 
`vthreadMode` ?

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

PR Review: https://git.openjdk.org/jdk/pull/32403#pullrequestreview-5013158802
PR Comment: https://git.openjdk.org/jdk/pull/32403#issuecomment-5402339339
PR Review Comment: https://git.openjdk.org/jdk/pull/32403#discussion_r3847973484
PR Review Comment: https://git.openjdk.org/jdk/pull/32403#discussion_r3847987454

Reply via email to