avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Cutting (JIRA)" <j...@apache.org>
Subject [jira] Updated: (AVRO-607) SpecificData.getSchema not thread-safe
Date Thu, 05 Aug 2010 22:25:16 GMT

     [ https://issues.apache.org/jira/browse/AVRO-607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Doug Cutting updated AVRO-607:

    Attachment: AVRO-607.patch

Here's a simple patch.  I've converted it to use ConcurrentHashMap instead.  We already have
static ConcurrentHashMaps that contain instances of Class, and most instances of Type are
Class.  So this will prevent classes and types from getting GC'd, but neither need to be GC'd

A better fix might be to update all uses of static ConcurrentHashMaps with 'new com.google.common.collect.
new MapMaker().weakKeys().makeMap()'.


Should we add a dependency on Google Collections?

> SpecificData.getSchema not thread-safe
> --------------------------------------
>                 Key: AVRO-607
>                 URL: https://issues.apache.org/jira/browse/AVRO-607
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.3.3
>            Reporter: Stephen Tu
>            Priority: Minor
>         Attachments: AVRO-607.patch
> 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. 

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message