avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrius Druzinis-Vitkus (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-607) SpecificData.getSchema not thread-safe
Date Fri, 22 Jul 2016 09:00:29 GMT

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

Andrius Druzinis-Vitkus commented on AVRO-607:
----------------------------------------------

Hi Sean, if I understand correctly, the avro module depends on avro-guava-dependencies (the
shaded slimmed-down jar) but not com.google.guava; in order to make a class available in avro,
it needs to be referenced in GuavaClasses. At least, that is how I read this comment:

{code:title=GuavaClasses.java|borderStyle=solid}
  /*
   * Referencing Guava classes here includes them in the minimized Guava jar
   * that is shaded in the avro jar.
   */
{code}

I wasn't sure which namespace to use in SpecificData.java and chose the com.google one because
classes GenericData and ReflectData also import from com.google and not org.apache.avro:

{code:title=GenericData.java|borderStyle=solid}
import com.google.common.collect.MapMaker;
{code}

{code:title=ReflectData.java|borderStyle=solid}
import com.google.common.collect.MapMaker;
{code}

Is the above reasoning correct? I will update the patch once we clear this up. 

> 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, 1.8.1
>            Reporter: Stephen Tu
>            Assignee: Andrius Druzinis-Vitkus
>            Priority: Blocker
>              Labels: newbie, patch
>             Fix For: 1.8.2
>
>         Attachments: AVRO-607.patch, 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 was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message