[jdk19] RFR: 8289692: JFR: Thread checkpoint no longer enforce mutual exclusion post Loom integration [v3]

Markus Grönlund mgronlun at openjdk.org
Thu Jul 7 12:26:55 UTC 2022


> Greetings,
> 
> Before integrating Loom and Virtual Threads, threads writing checkpoint meta-information claimed a checkpoint buffer from a list categorized as thread-local.
> Buffers on this list are not reset eagerly as part of a flushpoint but only as part of chunk rotation, where the JFR Recorder Thread has exclusive access by issuing a prior epoch shift.
> 
> With Loom, the thread-local buffers are exclusively dedicated to meta-information for Virtual Threads.
> The meta-information about the JVM thread, for example, the carrier thread, is written to a buffer located on the list categorized as global. Buffers on this list are reset eagerly during flushpoints. Before Loom, an invariant for this global list was that only the JFR Recorder Thread used it.
> This invariant no longer holds. The JFR Recorder Thread will reset buffers on this list without protection and can do so in the middle of another thread's attempted writes. Some consequences are asserts in debug builds and data loss in product builds.
> 
> Some mutex mechanism for the buffers on the global list must be re-introduced to prevent the JFR Recorder Thread from resetting buffers currently in use. This change set adds back proper protection.
> 
> Testing: jdk_jfr, stress
> 
> Thanks
> Markus

Markus Grönlund has updated the pull request incrementally with one additional commit since the last revision:

  assert Thread::current()

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

Changes:
  - all: https://git.openjdk.org/jdk19/pull/109/files
  - new: https://git.openjdk.org/jdk19/pull/109/files/dd40dbb5..3f2c22ec

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk19&pr=109&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk19&pr=109&range=01-02

  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk19/pull/109.diff
  Fetch: git fetch https://git.openjdk.org/jdk19 pull/109/head:pull/109

PR: https://git.openjdk.org/jdk19/pull/109


More information about the hotspot-jfr-dev mailing list