RFR: 8303674: JFR: TypeLibrary class not thread safe

Erik Gahlin egahlin at openjdk.org
Mon Mar 6 21:16:03 UTC 2023


Could I have review of a PR that makes the TypeLibrary class thread safe. 

The problem occur when an application creates new AnnotationElement to use for dynamic events. The new types/classes need to be added to the type library, but the MetadataRepository lock can't be used for various reasons.

The biggest risk with this change is the introduction of a dead lock between the metadata lock and the type library lock. During testing I added a check to all synchronised methods in MetadataRepository to ensure lock ordering is never violated. 

A better solution may be a separate lock class that TypeLibrary and MetadataRepository could share, but it's a large change and not so suitable for a backport.

Testing: 100 * jdk/jdk/jfr

Thanks
Erik

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

Commit messages:
 - Initial

Changes: https://git.openjdk.org/jdk/pull/12884/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12884&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8303674
  Stats: 46 lines in 2 files changed: 3 ins; 9 del; 34 mod
  Patch: https://git.openjdk.org/jdk/pull/12884.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12884/head:pull/12884

PR: https://git.openjdk.org/jdk/pull/12884


More information about the hotspot-jfr-dev mailing list