avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1781) Schema.parse is not thread safe
Date Wed, 13 Jan 2016 18:54:40 GMT

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

Hudson commented on AVRO-1781:
------------------------------

SUCCESS: Integrated in AvroJava #568 (See [https://builds.apache.org/job/AvroJava/568/])
AVRO-1781: Use Guava for a thread-safe weak identity cache.

This adds avro-guava-dependencies to minimize just Guava classes that
are shaded without minimizing classes from other dependencies. This
filtered artifact is then shaded and relocated in the avro module to
avoid leaking Guava classes to downstream consumers. (blue: rev 1724473)
* trunk/CHANGES.txt
* trunk/lang/java/avro/pom.xml
* trunk/lang/java/avro/src/main/java/org/apache/avro/LogicalTypes.java
* trunk/lang/java/avro/src/main/resources
* trunk/lang/java/avro/src/main/resources/META-INF
* trunk/lang/java/avro/src/main/resources/META-INF/LICENSE
* trunk/lang/java/guava
* trunk/lang/java/guava/pom.xml
* trunk/lang/java/guava/src
* trunk/lang/java/guava/src/main
* trunk/lang/java/guava/src/main/java
* trunk/lang/java/guava/src/main/java/org
* trunk/lang/java/guava/src/main/java/org/apache
* trunk/lang/java/guava/src/main/java/org/apache/avro
* trunk/lang/java/guava/src/main/java/org/apache/avro/GuavaClasses.java
* trunk/lang/java/guava/src/main/resources
* trunk/lang/java/guava/src/main/resources/META-INF
* trunk/lang/java/guava/src/main/resources/META-INF/LICENSE
* trunk/lang/java/mapred/pom.xml
* trunk/lang/java/pom.xml
* trunk/lang/java/tools/src/main/resources/META-INF/LICENSE


> Schema.parse is not thread safe
> -------------------------------
>
>                 Key: AVRO-1781
>                 URL: https://issues.apache.org/jira/browse/AVRO-1781
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.8.0
>            Reporter: Sean Busbey
>            Priority: Blocker
>             Fix For: 1.8.0
>
>         Attachments: AVRO-1781.1.patch, AVRO-1781.2.patch
>
>
> Post AVRO-1497, Schema.parse calls {{LogicalTypes.fromSchemaIgnoreInvalid}} on any schema
that is expressed as a JSON object (anything except bare primitives).
> That static method relies on a static cache based on WeakIdentityHashMap (WIHM).
> WIHM clearly states that it isn't threadsafe [ref|https://github.com/apache/avro/blob/branch-1.8/lang/java/avro/src/main/java/org/apache/avro/util/WeakIdentityHashMap.java#L42]
> {code}
>  * 
>  * Note that this implementation is not synchronized.
>  * </b>
>  */
> public class WeakIdentityHashMap<K, V> implements Map<K, V> {
> {code}
> All of the Schema.Parser instances use that same static Schema.parse method.
> The end result is that as-is it's only safe to have a single thread parsing schemas in
a given JVM.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message