You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Ted Yu (JIRA)" <ji...@apache.org> on 2017/02/15 17:15:42 UTC
[jira] [Comment Edited] (FLINK-5629) Unclosed RandomAccessFile in
StaticFileServerHandler#respondAsLeader()
[ 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/15/17 5:15 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)