-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDFS-16031. Possible Resource Leak in org.apache.hadoop.hdfs.server.aliasmap#InMemoryAliasMap #3027
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HDFS-16031. Possible Resource Leak in org.apache.hadoop.hdfs.server.aliasmap#InMemoryAliasMap #3027
Conversation
|
💔 -1 overall
This message was automatically generated. |
aajisaka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch.
We should use try-with-resources to close the resources.
|
💔 -1 overall
This message was automatically generated. |
| addFileToTarGzRecursively(tOut, aliasMapDir, "", new Configuration()); | ||
| } finally { | ||
| if (tOut != null) { | ||
| tOut.finish(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update.
- Before:
tOut.finish()is called if addFileToTarGzRecursively throws an exception. - Your patch:
tOut.finish()is not called if addFileToTarGzRecursively throws an exception.
I think we need to have an extra try-catch clause:
try {
addFileToTarGzRecursively(tOut, aliasMapDir, "", new Configuration());
} finally {
tOut.finish();
}
tOut cannot be null in the try-with-resources clause so that we can remove the null check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we define tOut in try-with-resources block, then we don't have access to tOut in finally block. I checked close() method in TarArchiveOutputStream and finish() is called there so I think we don't need to call finish on tOut.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6a74dd9
let me know if there is any problem.
|
💔 -1 overall
This message was automatically generated. |
aajisaka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, the test failures are not related.
- hadoop.cli.TestErasureCodingCLI #3052
The other tests passed in my local.
|
Thank you @Nargeshdb |
…liasmap#InMemoryAliasMap (apache#3027)
This PR fixes the issue mentioned here.