Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8303674

JFR: TypeLibrary class not thread safe

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 21
    • 11, 17, 21
    • hotspot
    • None
    • jfr
    • b14

      The TypeLibrary class is not properly protected from concurrent access. This can happen when creating dynamic events. A typical exception can look like this:

      Exception in thread "main" java.lang.ExceptionInInitializerError
        at jdk.jfr/jdk.jfr.EventFactory.create(EventFactory.java:169)
      ...
      Caused by: java.lang.ArrayIndexOutOfBoundsException\cf2 : Index 233 out of bounds for length 233
        at java.base/java.util.LinkedHashMap.valuesToArray(LinkedHashMap.java:555)
        at java.base/java.util.LinkedHashMap$LinkedValues.toArray(LinkedHashMap.java:635)
        at java.base/java.util.ArrayList.<init>(ArrayList.java:181)
        at jdk.jfr/jdk.jfr.internal.TypeLibrary.getTypes(TypeLibrary.java:122)
        at jdk.jfr/jdk.jfr.internal.MetadataRepository.initializeJVMEventTypes(MetadataRepository.java:74)
        at jdk.jfr/jdk.jfr.internal.MetadataRepository.<init>(MetadataRepository.java:69)
        at jdk.jfr/jdk.jfr.internal.MetadataRepository.<clinit>(MetadataRepository.java:56)

      Normally all access to metadata requires the "metadata lock", but there are some exceptions. Problem is that the TypeLibrary can't depend on MetadataRepository class without a recursion. Some of this dealt with by using the TypeLibrary class lock, but not in all places.

            egahlin Erik Gahlin
            egahlin Erik Gahlin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: