You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by sp...@apache.org on 2016/05/27 15:37:29 UTC
[08/48] hive git commit: HIVE-13729: FileSystem leaks in
FileUtils.checkFileAccessWithImpersonation
HIVE-13729: FileSystem leaks in FileUtils.checkFileAccessWithImpersonation
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/ba070558
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/ba070558
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/ba070558
Branch: refs/heads/java8
Commit: ba070558a14162efbc81d5f8fe374ee75d43133b
Parents: 76961d1
Author: Daniel Dai <da...@hortonworks.com>
Authored: Wed May 25 21:44:54 2016 -0700
Committer: Daniel Dai <da...@hortonworks.com>
Committed: Wed May 25 21:44:54 2016 -0700
----------------------------------------------------------------------
.../apache/hadoop/hive/common/FileUtils.java | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/ba070558/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/common/FileUtils.java b/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
index 5cf4d39..d755798 100644
--- a/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
+++ b/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
@@ -387,14 +387,18 @@ public final class FileUtils {
// Otherwise, try user impersonation. Current user must be configured to do user impersonation.
UserGroupInformation proxyUser = UserGroupInformation.createProxyUser(
user, UserGroupInformation.getLoginUser());
- proxyUser.doAs(new PrivilegedExceptionAction<Object>() {
- @Override
- public Object run() throws Exception {
- FileSystem fsAsUser = FileSystem.get(fs.getUri(), fs.getConf());
- ShimLoader.getHadoopShims().checkFileAccess(fsAsUser, stat, action);
- return null;
- }
- });
+ try {
+ proxyUser.doAs(new PrivilegedExceptionAction<Object>() {
+ @Override
+ public Object run() throws Exception {
+ FileSystem fsAsUser = FileSystem.get(fs.getUri(), fs.getConf());
+ ShimLoader.getHadoopShims().checkFileAccess(fsAsUser, stat, action);
+ return null;
+ }
+ });
+ } finally {
+ FileSystem.closeAllForUGI(proxyUser);
+ }
}
/**