Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-607

SpecificData.getSchema not thread-safe

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 1.3.3, 1.8.1
    • 1.8.2
    • java
    • Method org.apache.avro.specific.SpecificData::getSchema(type) to use Guava's LoadingCache instead of a Map to avoid race conditions.

    Description

      SpecificData.getSchema uses a WeakHashMap to cache schemas, but WeakHashMap is not thread-safe, and the method itself is not synchronized. Seems like this could lead to the data structure getting corrupted.

      Attachments

        1. AVRO-607.patch
          0.9 kB
          Doug Cutting
        2. AVRO-607.patch
          3 kB
          Andrius Druzinis-Vitkus
        3. 0001-AVRO-607-Changed-SpecificData.getSchema-to-use-a-thr.patch
          3 kB
          Andrius Druzinis-Vitkus

        Issue Links

          Activity

            People

              Andrius Driu Andrius Druzinis-Vitkus
              stephentu Stephen Tu
              Votes:
              2 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: