You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Devaraj K (JIRA)" <ji...@apache.org> on 2011/03/16 10:52:29 UTC
[jira] Created: (HADOOP-7194) Potential Resource leak in
IOUtils.java
Potential Resource leak in IOUtils.java
---------------------------------------
Key: HADOOP-7194
URL: https://issues.apache.org/jira/browse/HADOOP-7194
Project: Hadoop Common
Issue Type: Bug
Components: io
Affects Versions: 0.23.0
Reporter: Devaraj K
{code:title=IOUtils.java|borderStyle=solid}
try {
copyBytes(in, out, buffSize);
} finally {
if(close) {
out.close();
in.close();
}
}
{code}
In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (HADOOP-7194) Potential Resource leak in
IOUtils.java
Posted by "Tsz Wo (Nicholas), SZE (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tsz Wo (Nicholas), SZE updated HADOOP-7194:
-------------------------------------------
Assignee: Devaraj K
Hadoop Flags: [Reviewed]
> Potential Resource leak in IOUtils.java
> ---------------------------------------
>
> Key: HADOOP-7194
> URL: https://issues.apache.org/jira/browse/HADOOP-7194
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Affects Versions: 0.23.0
> Reporter: Devaraj K
> Assignee: Devaraj K
> Attachments: HADOOP-7194.patch
>
>
> {code:title=IOUtils.java|borderStyle=solid}
> try {
> copyBytes(in, out, buffSize);
> } finally {
> if(close) {
> out.close();
> in.close();
> }
> }
> {code}
> In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (HADOOP-7194) Potential Resource leak in
IOUtils.java
Posted by "Devaraj K (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Devaraj K updated HADOOP-7194:
------------------------------
Attachment: HADOOP-7194.patch
> Potential Resource leak in IOUtils.java
> ---------------------------------------
>
> Key: HADOOP-7194
> URL: https://issues.apache.org/jira/browse/HADOOP-7194
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Affects Versions: 0.23.0
> Reporter: Devaraj K
> Attachments: HADOOP-7194.patch
>
>
> {code:title=IOUtils.java|borderStyle=solid}
> try {
> copyBytes(in, out, buffSize);
> } finally {
> if(close) {
> out.close();
> in.close();
> }
> }
> {code}
> In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (HADOOP-7194) Potential Resource leak in
IOUtils.java
Posted by "Tsz Wo (Nicholas), SZE (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tsz Wo (Nicholas), SZE updated HADOOP-7194:
-------------------------------------------
Affects Version/s: (was: 0.23.0)
> Potential Resource leak in IOUtils.java
> ---------------------------------------
>
> Key: HADOOP-7194
> URL: https://issues.apache.org/jira/browse/HADOOP-7194
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Reporter: Devaraj K
> Assignee: Devaraj K
> Attachments: HADOOP-7194.patch
>
>
> {code:title=IOUtils.java|borderStyle=solid}
> try {
> copyBytes(in, out, buffSize);
> } finally {
> if(close) {
> out.close();
> in.close();
> }
> }
> {code}
> In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (HADOOP-7194) Potential Resource leak in
IOUtils.java
Posted by "Devaraj K (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13011916#comment-13011916 ]
Devaraj K commented on HADOOP-7194:
-----------------------------------
Thanks Nicholas for reviewing.
Closing the streams in the finally-block using closeStream(..) will suppress the exception if out.close()/in.close() throws and will not be thrown back to the caller.
{code:xml}
if(close) {
out.close();
+ out = null;
in.close();
+ in = null;
}
{code}
With the above lines if out.close() throws exception that will be thrown back to the caller and also other streams will be closed in finally-block using closeStream(..).
As per the discussions in the issue MAPREDUCE-2243, this way is followed.
> Potential Resource leak in IOUtils.java
> ---------------------------------------
>
> Key: HADOOP-7194
> URL: https://issues.apache.org/jira/browse/HADOOP-7194
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Affects Versions: 0.23.0
> Reporter: Devaraj K
> Attachments: HADOOP-7194.patch
>
>
> {code:title=IOUtils.java|borderStyle=solid}
> try {
> copyBytes(in, out, buffSize);
> } finally {
> if(close) {
> out.close();
> in.close();
> }
> }
> {code}
> In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (HADOOP-7194) Potential Resource leak in
IOUtils.java
Posted by "Tsz Wo (Nicholas), SZE (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13012131#comment-13012131 ]
Tsz Wo (Nicholas), SZE commented on HADOOP-7194:
------------------------------------------------
> Closing the streams in the finally-block using closeStream(..) will suppress the exception ...
Good point.
+1 then.
> Potential Resource leak in IOUtils.java
> ---------------------------------------
>
> Key: HADOOP-7194
> URL: https://issues.apache.org/jira/browse/HADOOP-7194
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Affects Versions: 0.23.0
> Reporter: Devaraj K
> Attachments: HADOOP-7194.patch
>
>
> {code:title=IOUtils.java|borderStyle=solid}
> try {
> copyBytes(in, out, buffSize);
> } finally {
> if(close) {
> out.close();
> in.close();
> }
> }
> {code}
> In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (HADOOP-7194) Potential Resource leak in
IOUtils.java
Posted by "Tsz Wo (Nicholas), SZE (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13011411#comment-13011411 ]
Tsz Wo (Nicholas), SZE commented on HADOOP-7194:
------------------------------------------------
Good catch! It seems that closing in the finally-block using {{closeStream(..)}} is sufficient. The following is not required.
{code}
if(close) {
out.close();
+ out = null;
in.close();
+ in = null;
}
{code}
> Potential Resource leak in IOUtils.java
> ---------------------------------------
>
> Key: HADOOP-7194
> URL: https://issues.apache.org/jira/browse/HADOOP-7194
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Affects Versions: 0.23.0
> Reporter: Devaraj K
> Attachments: HADOOP-7194.patch
>
>
> {code:title=IOUtils.java|borderStyle=solid}
> try {
> copyBytes(in, out, buffSize);
> } finally {
> if(close) {
> out.close();
> in.close();
> }
> }
> {code}
> In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (HADOOP-7194) Potential Resource leak in
IOUtils.java
Posted by "Devaraj K (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Devaraj K updated HADOOP-7194:
------------------------------
Status: Patch Available (was: Open)
> Potential Resource leak in IOUtils.java
> ---------------------------------------
>
> Key: HADOOP-7194
> URL: https://issues.apache.org/jira/browse/HADOOP-7194
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Affects Versions: 0.23.0
> Reporter: Devaraj K
> Attachments: HADOOP-7194.patch
>
>
> {code:title=IOUtils.java|borderStyle=solid}
> try {
> copyBytes(in, out, buffSize);
> } finally {
> if(close) {
> out.close();
> in.close();
> }
> }
> {code}
> In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (HADOOP-7194) Potential Resource leak in
IOUtils.java
Posted by "Hudson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13012156#comment-13012156 ]
Hudson commented on HADOOP-7194:
--------------------------------
Integrated in Hadoop-Common-trunk-Commit #536 (See [https://hudson.apache.org/hudson/job/Hadoop-Common-trunk-Commit/536/])
HADOOP-7194. Fix resource leak in IOUtils.copyBytes(..). Contributed by Devaraj K
> Potential Resource leak in IOUtils.java
> ---------------------------------------
>
> Key: HADOOP-7194
> URL: https://issues.apache.org/jira/browse/HADOOP-7194
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Reporter: Devaraj K
> Assignee: Devaraj K
> Fix For: 0.21.1, 0.22.0, 0.23.0
>
> Attachments: HADOOP-7194.patch
>
>
> {code:title=IOUtils.java|borderStyle=solid}
> try {
> copyBytes(in, out, buffSize);
> } finally {
> if(close) {
> out.close();
> in.close();
> }
> }
> {code}
> In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (HADOOP-7194) Potential Resource leak in
IOUtils.java
Posted by "Tsz Wo (Nicholas), SZE (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tsz Wo (Nicholas), SZE updated HADOOP-7194:
-------------------------------------------
Resolution: Fixed
Fix Version/s: 0.23.0
0.22.0
0.21.1
Status: Resolved (was: Patch Available)
I have committed this. Thanks, Devaraj!
> Potential Resource leak in IOUtils.java
> ---------------------------------------
>
> Key: HADOOP-7194
> URL: https://issues.apache.org/jira/browse/HADOOP-7194
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Reporter: Devaraj K
> Assignee: Devaraj K
> Fix For: 0.21.1, 0.22.0, 0.23.0
>
> Attachments: HADOOP-7194.patch
>
>
> {code:title=IOUtils.java|borderStyle=solid}
> try {
> copyBytes(in, out, buffSize);
> } finally {
> if(close) {
> out.close();
> in.close();
> }
> }
> {code}
> In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (HADOOP-7194) Potential Resource leak in
IOUtils.java
Posted by "Hudson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13012245#comment-13012245 ]
Hudson commented on HADOOP-7194:
--------------------------------
Integrated in Hadoop-Common-22-branch #37 (See [https://hudson.apache.org/hudson/job/Hadoop-Common-22-branch/37/])
HADOOP-7194. Fix resource leak in IOUtils.copyBytes(..). Contributed by Devaraj K
> Potential Resource leak in IOUtils.java
> ---------------------------------------
>
> Key: HADOOP-7194
> URL: https://issues.apache.org/jira/browse/HADOOP-7194
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Reporter: Devaraj K
> Assignee: Devaraj K
> Fix For: 0.21.1, 0.22.0, 0.23.0
>
> Attachments: HADOOP-7194.patch
>
>
> {code:title=IOUtils.java|borderStyle=solid}
> try {
> copyBytes(in, out, buffSize);
> } finally {
> if(close) {
> out.close();
> in.close();
> }
> }
> {code}
> In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (HADOOP-7194) Potential Resource leak in
IOUtils.java
Posted by "Hudson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13012428#comment-13012428 ]
Hudson commented on HADOOP-7194:
--------------------------------
Integrated in Hadoop-Common-trunk #645 (See [https://hudson.apache.org/hudson/job/Hadoop-Common-trunk/645/])
HADOOP-7194. Fix resource leak in IOUtils.copyBytes(..). Contributed by Devaraj K
> Potential Resource leak in IOUtils.java
> ---------------------------------------
>
> Key: HADOOP-7194
> URL: https://issues.apache.org/jira/browse/HADOOP-7194
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Reporter: Devaraj K
> Assignee: Devaraj K
> Fix For: 0.21.1, 0.22.0, 0.23.0
>
> Attachments: HADOOP-7194.patch
>
>
> {code:title=IOUtils.java|borderStyle=solid}
> try {
> copyBytes(in, out, buffSize);
> } finally {
> if(close) {
> out.close();
> in.close();
> }
> }
> {code}
> In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (HADOOP-7194) Potential Resource leak in
IOUtils.java
Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13012140#comment-13012140 ]
Hadoop QA commented on HADOOP-7194:
-----------------------------------
+1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12474511/HADOOP-7194.patch
against trunk revision 1085122.
+1 @author. The patch does not contain any @author tags.
+1 tests included. The patch appears to include 3 new or modified tests.
+1 javadoc. The javadoc tool did not generate any warning messages.
+1 javac. The applied patch does not increase the total number of javac compiler warnings.
+1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings.
+1 release audit. The applied patch does not increase the total number of release audit warnings.
+1 core tests. The patch passed core unit tests.
+1 contrib tests. The patch passed contrib unit tests.
+1 system test framework. The patch passed system test framework compile.
Test results: https://hudson.apache.org/hudson/job/PreCommit-HADOOP-Build/321//testReport/
Findbugs warnings: https://hudson.apache.org/hudson/job/PreCommit-HADOOP-Build/321//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://hudson.apache.org/hudson/job/PreCommit-HADOOP-Build/321//console
This message is automatically generated.
> Potential Resource leak in IOUtils.java
> ---------------------------------------
>
> Key: HADOOP-7194
> URL: https://issues.apache.org/jira/browse/HADOOP-7194
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Affects Versions: 0.23.0
> Reporter: Devaraj K
> Assignee: Devaraj K
> Attachments: HADOOP-7194.patch
>
>
> {code:title=IOUtils.java|borderStyle=solid}
> try {
> copyBytes(in, out, buffSize);
> } finally {
> if(close) {
> out.close();
> in.close();
> }
> }
> {code}
> In the above code if any exception throws from the out.close() statement, in.close() statement will not execute and the input stream will not be closed.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira