RFR: 8303674: JFR: TypeLibrary class not thread safe [v2]

Erik Gahlin egahlin at openjdk.org
Tue Mar 7 20:50:56 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

Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision:

  Change order of static and synchronized

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/12884/files
  - new: https://git.openjdk.org/jdk/pull/12884/files/37bb1d9f..6ac2b17e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12884&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12884&range=00-01

  Stats: 11 lines in 1 file changed: 0 ins; 0 del; 11 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