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

ASF GitHub Bot commented on AVRO-2122:
--------------------------------------

GitHub user brtm opened a pull request:

    https://github.com/apache/avro/pull/281

    AVRO-2122 track which symbols have been visited to avoid 
StackOverflowErrors (PR for master branch)

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/brtm/avro master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/avro/pull/281.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #281
    
----
commit 31c41be11db48d231fdc3357fac4e51ab3dcdf5c
Author: Bart <brtm@...>
Date:   2018-01-03T14:03:57Z

    AVRO-2122 track which symbols have been visited to avoid 
StackOverflowErrors when validating schemas with recursive definitions

commit a2dfddf2f8ab3062c2a57fbcb5db4978b1bff80c
Author: Bart <brtm@...>
Date:   2018-01-16T14:08:33Z

    AVRO-2122 processed review comments
    - removed trailing spaces from Symbol.java, it caused mvn:test to fail
    - moved the test in RecursiveSymbolTest to TestSchemaValidation (with a 
meaningful name)
    
    # Conflicts:
    #   lang/java/avro/src/test/java/org/apache/avro/TestSchemaValidation.java

----


> Cannot validate schemas with recursive definitions
> --------------------------------------------------
>
>                 Key: AVRO-2122
>                 URL: https://issues.apache.org/jira/browse/AVRO-2122
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.8.2
>            Reporter: Bart
>            Priority: Major
>
> Validating a schema with a recursive definition will lead to a stack 
> overflow. When using the following schema definition:
> {noformat}
> @namespace("avro")
> protocol Unused {
> record Node {
>   union { null, Node } value = null;
> }
> }
> {noformat}
> {code:java}
> final SchemaValidator backwardValidator = new SchemaValidatorBuilder()
>   .canReadStrategy().validateLatest();
> backwardValidator.validate(Node.SCHEMA$, Arrays.asList(Node.SCHEMA$));
> {code}
> It results in a stack trace:
> {noformat}
> java.lang.StackOverflowError
>         at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:406)
>         at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:392)
>         at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:383)
>         at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:406)
>         at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:392)
>         at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:406)
>         at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:374)
>         at org.apache.avro.io.parsing.Symbol.hasErrors(Symbol.java:406)
>         ...
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to