avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Safrata (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AVRO-1715) Compiling a schema leaves the schema file open
Date Wed, 07 Oct 2015 20:09:28 GMT

     [ https://issues.apache.org/jira/browse/AVRO-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Pavel Safrata updated AVRO-1715:
    Attachment: AVRO-1715.5.diff

Thank you for your help, it looks good. I offer a small refactoring to avoid the code duplication,
please see the fifth version of the patch. It adds a method to the API which I don't know
if I'm allowed to do, feel free to ignore this and commit your version.

> Compiling a schema leaves the schema file open
> ----------------------------------------------
>                 Key: AVRO-1715
>                 URL: https://issues.apache.org/jira/browse/AVRO-1715
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.7, 1.8.0
>            Reporter: Pavel Safrata
>             Fix For: 1.8.0
>         Attachments: AVRO-1715.4.diff, AVRO-1715.5.diff, Schema_close_parser.patch, Schema_close_parser_v2.patch,
> The schema compiler leaves the schema file open. This is demonstrated on the following
> File schemaFile = new File("schema.avsc");
> SpecificCompiler.compileSchema(new File[] { schemaFile }, new File("output"));
> Files.delete(schemaFile.toPath());
> On Windows I get "java.nio.file.FileSystemException: schema.avsc: The process cannot
access the file because it is being used by another process."
> The problem is in Schema.java, method parse(File). This method creates a JsonParser for
the schema file but never closes it, so the parser stays open together with the FileInputStream
created by it. Closing the parser fixes the problem. I believe the same should be done for
the other types of inputs as the json parsers do use more resources that should be freed.
So I propose to close the parser in the parse(JsonParser) method. I will attach the patch.
> This is almost a blocker for our project and I would really appreciate if we can have
this resolved for 1.8. Please let me know if that's possible and whether I should go ahead
with merging the change myself (it's my first contribution here).

This message was sent by Atlassian JIRA

View raw message