[
https://issues.apache.org/jira/browse/AVRO-1220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Doug Cutting updated AVRO-1220:
-------------------------------
Attachment: AVRO-1220.txt
The problem is that, when different subclasses of Symbol are loaded in
different threads, each then loads Symbol itself, which then loads those
subclasses while binding constants, and things deadlock.
I've attached a better fix that removes all public constructors for Symbol
subclasses and replaces them with factory methods on Symbol. So none of the
subclasses are loaded until after Symbol itself is loaded and all of its
constants are bound.
I tried to test this using the code linked in the description of this issue.
Without the patch things deadlock. With the patch they fail with:
JSON record should::be readable when a nullable field has been added to the
schema(com.axa.ags.avro.AvroJsonEncodingTest): Expected field name not found:
foo
Is that expected?
I tried to build a simple, standalone Java test case for this but was unable to
get things to deadlock.
If this new patch looks reasonable then I'll probably re-add the public
constructors and deprecate them for back-compatibility. I removed them just to
be certain that they were no longer called anywhere.
> Dead lock
> ----------
>
> Key: AVRO-1220
> URL: https://issues.apache.org/jira/browse/AVRO-1220
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.7.3
> Environment: OSX, JDK6
> Reporter: Stéphane Landelle
> Attachments: AVRO-1220.txt, AVRO-1220.txt
>
>
> I experience a dead lock when running multiple DataFileReader in concurrent
> threads.
> See test case here:
> https://github.com/slandelle/avro-test
> AvroBinaryEncodingTest randomly stalls about 50% of the time.
> A thread dump would show a dead lock in org.apache.avro.io.parsing.Symbol
> class initialization.
> IHMO, the problem is that the Symbol class has static final members that are
> instances of Symbol subclasses.
> I built a custom version of avro where all the constants (NULL, BOOLEAN, INT,
> etc) have been extracted into a dedicated class outside of Symbol hierarchy
> and the test case now runs fine.
> Cheers,
> Stéphane Landelle
--
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