RFR: 8307298: JFR: Ensure jdk.jfr.internal.TypeLibrary is initialized only once [v3]
Robert Toyonaga
duke at openjdk.org
Thu May 11 13:54:52 UTC 2023
On Wed, 10 May 2023 22:40:06 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
> Is there a (GraalVM) reason the boolean is volatile? Should be sufficient with synchronized.
Yes, the problem isn't that there's a race to initialize `TypeLibrary`. Instead, the reason this is needed for Native Image is that JFR is used in two stages, both at build time and runtime. Because of this, JFR singletons such as `MetadataRepository` must be cleared and reinitialized between stages in order to keep JFR data from one stage leaking into the next (ie. we reinitialize after build time before running). This means that `TypeLibrary` will attempt to be initialized twice.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13760#issuecomment-1544006703
More information about the hotspot-jfr-dev
mailing list