RFR: 8315373: Change VirtualThread to unmount after freezing, re-mount before thawing [v2]

Serguei Spitsyn sspitsyn at openjdk.org
Wed Sep 6 05:04:49 UTC 2023


On Mon, 4 Sep 2023 08:24:19 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> In the virtual thread implementation, thread identity switches to the carrier before freezing and switches back to the virtual thread after thawing. This was a forced move due to issues getting JVMTI to work with virtual threads. JVMTI can now hide events during transitions so we can invert the sequence back to mounting before running the continuation, unmounting after freezing, and re-mounting after thawing. This sequence is important for future changes that will initiate the freezing from the VM.
>> 
>> The change requires an update to the JFR thread sampler to skip sampling when it samples during a transition.
>> 
>> Testing: tier1-5
>
> Alan Bateman has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Check for transition during stack walk for synchronous case
>  - Merge
>  - Initial commit

The fix looks okay to me. From JVMTI point of view this transition is hidden, so no inconsistency can be observed. However, I wonder if the AsyncGetStackTraces may have similar issue as the JFR had. Unfortunately we do not have good test coverage to rely on.
Thanks,
Serguei

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

Marked as reviewed by sspitsyn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15492#pullrequestreview-1612449636


More information about the serviceability-dev mailing list