On Thu, 15 Aug 2024 04:11:47 GMT, David Holmes <dhol...@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 > > src/jdk.jfr/share/classes/jdk/jfr/internal/StringPool.java line 93: > >> 91: private static long storeString(String s) { >> 92: try { >> 93: pinVirtualThread(); > > The pin should be outside the try so that the finally can only happen if > pinning was succesful. Good point, thanks. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20588#discussion_r1718199292