RFR: 8338417: Explicitly pin a virtual thread before acquiring the JFR string pool monitor [v5]

Alan Bateman alanb at openjdk.org
Fri Aug 23 07:38:03 UTC 2024


On Wed, 21 Aug 2024 18:26:20 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:

>> Greetings,
>> 
>> Explicitly pin a virtual thread before acquiring the JFR string pool monitor because migrating a carrier thread local event writer object onto another carrier thread is impossible.
>> 
>> During event commit, the thread is in a critical section because it has loaded a carrier thread local event writer object. For virtual threads, a contended monitor, such as a synchronized block, is a point where a thread could become unmounted.
>> 
>> A monitor guards the JFR string pool, but remounting a virtual thread onto another carrier is impossible because of the event writer.
>> 
>> Therefore, it's imperative to use explicit pin constructs to prevent unmounting at this location. 
>> 
>> Testing: jdk_jfr
>> 
>> Thanks
>> Markus
>
> Markus Grönlund has updated the pull request incrementally with five additional commits since the last revision:
> 
>  - pin state conditional delivered using event writer object
>  - Merge branch '8338417' of github.com:mgronlun/jdk into 8338417
>  - update test comment
>  - hoist pinVirtualThread
>  - 8338417

Marked as reviewed by alanb (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/20588#pullrequestreview-2256567425


More information about the core-libs-dev mailing list