On Sat, 14 Oct 2023 18:07:45 GMT, Alan Bateman <al...@openjdk.org> wrote:

> JVMTI is notified after a virtual thread unmounts. Right not, this 
> notification is done after the virtual thread has finished parking or 
> yielding so it's possible for the virtual to continue, and be mounted on a 
> different carrier, before the unmount notification has completed on the 
> original carrier. If this happens it means the the JVMTI mount and unmount 
> notifications will race and it's possible they could be unbalanced. The 
> unmount notification needs to move to after the unmount and before the 
> virtual thread state is changed.
> 
> While in the area, I've removed @ChangesCurrentThread from VirtualThread.run. 
> This annotation was in place to workaround an issue with the notifyJvmtiXXX 
> instrinsics, fixed recently by JDK-8316130.
> 
> Testing: tier1-6.

I tested tier1-tier6 with the JVMTI notifications moved to mount/unmount and 
don't see any failures. So if you are okay with that then it would be a bit 
nicer. The main thing is that the notification is done before the virtual 
thread state changes.

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

PR Comment: https://git.openjdk.org/jdk/pull/16194#issuecomment-1770419322

Reply via email to