Uploaded image for project: 'Avro'
  1. Avro
  2. AVRO-2122

Cannot validate schemas with recursive definitions

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2
    • Fix Version/s: 1.7.8, 1.9.0, 1.8.3
    • Component/s: java
    • Labels:
      None

      Description

      Validating a schema with a recursive definition will lead to a stack overflow. When using the following schema definition:

      @namespace("avro")
      protocol Unused {
      
      record Node {
        union { null, Node } value = null;
      }
      }
      
      final SchemaValidator backwardValidator = new SchemaValidatorBuilder()
        .canReadStrategy().validateLatest();
      backwardValidator.validate(Node.SCHEMA$, Arrays.asList(Node.SCHEMA$));
      

      It results in a stack trace:

      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)
              ...
      

        Attachments

          Activity

            People

            • Assignee:
              bart Bart
              Reporter:
              bart Bart
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: