You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by da...@apache.org on 2016/05/26 16:52:41 UTC
[4/4] hive git commit: HIVE-13729: FileSystem leaks in
FileUtils.checkFileAccessWithImpersonation (Daniel Dai,
reviewed by Thejas Nair)
HIVE-13729: FileSystem leaks in FileUtils.checkFileAccessWithImpersonation (Daniel Dai, reviewed by Thejas Nair)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/ffbd633f
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/ffbd633f
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/ffbd633f
Branch: refs/heads/branch-2.1
Commit: ffbd633fa448651e5c15c61826427537b31c160c
Parents: 2209cab
Author: Daniel Dai <da...@hortonworks.com>
Authored: Wed May 25 21:44:54 2016 -0700
Committer: Daniel Dai <da...@hortonworks.com>
Committed: Thu May 26 09:52:00 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/ffbd633f/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);
+ }
}
/**