You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "Keith Turner (JIRA)" <ji...@apache.org> on 2013/08/29 22:23:51 UTC

[jira] [Commented] (ACCUMULO-1676) Potential resource leak in RBlockState ctor due to un-closed streams

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

Keith Turner commented on ACCUMULO-1676:
----------------------------------------

Closing tempDataInputStream would close boundedRangeFileInputStream which is used later in the code.  I think its probably ok to not close it, I think it will be garbage collected when dereferenced even if not closed.

I suspect RBlockState.finish() will close inputStreamToBeCompressed and boundedRangeFileInputStream, but I did not trace the code through to be sure.  I suspose this depends on the stream returned by cryptoParams.getPlaintextInputStream() closing boundedRangeFileInputStream.   Even if its not a closed, it may not be a problem because BCFile reuses its FSDataInputStream to read bcfile blocks and bcfile itself never closes the FSDataInputStream it was passed.  BoundedRangeFileInputStream.close() intentionally does not close the stream it wraps.


           

                
> Potential resource leak in RBlockState ctor due to un-closed streams
> --------------------------------------------------------------------
>
>                 Key: ACCUMULO-1676
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-1676
>             Project: Accumulo
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Priority: Minor
>
> In RBlockState ctor,
> {code}
>           DataInputStream tempDataInputStream = new DataInputStream(boundedRangeFileInputStream);
>           // Read the init vector from the front of the stream before initializing the cipher stream
>           
>           int ivLength = tempDataInputStream.readInt();
>           byte[] initVector = new byte[ivLength];
>           tempDataInputStream.readFully(initVector);
> {code}
> tempDataInputStream should be closed.
> Closing boundedRangeFileInputStream and inputStreamToBeCompressed should be considered as well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira