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

SpecificData.getSchema not thread-safe

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.3.3, 1.8.1
    • Fix Version/s: 1.8.2
    • Component/s: java
    • Labels:
    • Release Note:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: