flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Yu (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (FLINK-5629) Unclosed RandomAccessFile in StaticFileServerHandler#respondAsLeader()
Date Wed, 22 Feb 2017 15:56:44 GMT

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

Ted Yu edited comment on FLINK-5629 at 2/22/17 3:56 PM:
--------------------------------------------------------

RandomAccessFile#length() may throw IOE.
raf is used in the following code path where DefaultFileRegion is not involved:
{code}
    } else {
      lastContentFuture = ctx.writeAndFlush(new HttpChunkedInput(new ChunkedFile(raf, 0, fileLength,
8192)),
{code}
It is good practice to close RandomAccessFile in all code paths.


was (Author: yuzhihong@gmail.com):
RandomAccessFile#length() may throw IOE.
raf is used in the following code path where DefaultFileRegion is not involved:
{code}
    } else {
      lastContentFuture = ctx.writeAndFlush(new HttpChunkedInput(new ChunkedFile(raf, 0, fileLength,
8192)),
{code}

It is good practice to close RandomAccessFile in all code paths.

> Unclosed RandomAccessFile in StaticFileServerHandler#respondAsLeader()
> ----------------------------------------------------------------------
>
>                 Key: FLINK-5629
>                 URL: https://issues.apache.org/jira/browse/FLINK-5629
>             Project: Flink
>          Issue Type: Bug
>          Components: Webfrontend
>            Reporter: Ted Yu
>            Priority: Minor
>
> {code}
>     final RandomAccessFile raf;
>     try {
>       raf = new RandomAccessFile(file, "r");
> ...
>     long fileLength = raf.length();
> {code}
> The RandomAccessFile should be closed upon return from method.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message