nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Payne (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (NIFI-4215) Avro schemas with records that have a field of themselves fail to parse, causing stackoverflow exception
Date Tue, 01 Aug 2017 13:54:02 GMT

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

Mark Payne commented on NIFI-4215:
----------------------------------

[~jameswing] [~WesleyLawrence] I have re-opened this ticket because it's caused a couple of
problems. The AvroTypeUtil class was modified to create a SimpleRecordSchema with a SchemaIdentifier
of EMPTY instead of creating the proper Schema Identifier. This prevents the Schema Writers
from having any way to write out the Schema Name, Schema Identifier or Schema Version. Also,
it changed the SimpleRecordSchema so that it is no longer immutable. We need to ensure that
the class remains immutable, because otherwise it is no longer thread-safe. Alternatively,
we could add synchronization as appropriate, but I would much prefer to avoid this. Making
the object immutable is much cleaner in my opinion, and results in fewer problems down the
road.

> Avro schemas with records that have a field of themselves fail to parse, causing stackoverflow
exception
> --------------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-4215
>                 URL: https://issues.apache.org/jira/browse/NIFI-4215
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 1.4.0
>            Reporter: Wesley L Lawrence
>            Priority: Minor
>             Fix For: 1.4.0
>
>         Attachments: nifi-4215.patch
>
>
> Noticed this while attempting to use the AvroSchemaRegsitry with some complex schema.
Boiled down, Avro lets you define a schema such as;
> {code}
> { 
>   "namespace": "org.apache.nifi.testing", 
>   "name": "CompositRecord", 
>   "type": "record", 
>   "fields": [ 
>     { 
>       "name": "id", 
>       "type": "int" 
>     }, 
>     { 
>       "name": "value", 
>       "type": "string" 
>     }, 
>     { 
>       "name": "parent", 
>       "type": [
>         "null",
>         "CompositRecord"
>       ]
>     } 
>   ] 
> }
> {code}
> The AvroSchemaRegistry (AvroTypeUtil specifically) will fail to parse, and generate a
stackoverflow exception.
> I've whipped up a fix, tested it out in 1.4.0, and am just running through the contrib
build before I submit a patch.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message