avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Carey (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-607) SpecificData.getSchema not thread-safe
Date Wed, 01 May 2013 23:02:15 GMT

    [ https://issues.apache.org/jira/browse/AVRO-607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13647037#comment-13647037
] 

Scott Carey commented on AVRO-607:
----------------------------------

If I recall, that turns out to be very hard due to how the equals contract works with weak
references.  There is already a Java WeakHashMap, so making one with identity semantics wasn't
too hard.
We may need thousands of lines of code and might have to implement our own concurrent map
implementation.  I think I'd rather spend my efforts figuring out how to extract Google's
implementation into another namespace in the build with shade, jarjar, or similar.
                
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message