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. This pull request has now been integrated. Changeset: c46a54e0 Author: Alan Bateman <al...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/c46a54e01815c5d441a958aa81451e66849ce774 Stats: 33 lines in 1 file changed: 11 ins; 13 del; 9 mod 8312777: notifyJvmtiMount before notifyJvmtiUnmount Reviewed-by: mli, sspitsyn ------------- PR: https://git.openjdk.org/jdk/pull/16194