You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sz...@apache.org on 2018/01/10 19:02:25 UTC
hadoop git commit: HADOOP-15060.
TestShellBasedUnixGroupsMapping.testFiniteGroupResolutionTime flaky.
Contributed by Miklos Szegedi.
Repository: hadoop
Updated Branches:
refs/heads/trunk 1a09da740 -> 12d064599
HADOOP-15060. TestShellBasedUnixGroupsMapping.testFiniteGroupResolutionTime flaky. Contributed by Miklos Szegedi.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/12d06459
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/12d06459
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/12d06459
Branch: refs/heads/trunk
Commit: 12d0645990a878f78216235c800ae4e157796160
Parents: 1a09da7
Author: Miklos Szegedi <sz...@apache.org>
Authored: Tue Jan 9 17:14:18 2018 -0800
Committer: Miklos Szegedi <sz...@apache.org>
Committed: Wed Jan 10 10:52:26 2018 -0800
----------------------------------------------------------------------
.../security/ShellBasedUnixGroupsMapping.java | 53 +++++++++++++-------
1 file changed, 36 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/12d06459/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedUnixGroupsMapping.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedUnixGroupsMapping.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedUnixGroupsMapping.java
index 4146e7b..94698d8 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedUnixGroupsMapping.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedUnixGroupsMapping.java
@@ -158,6 +158,32 @@ public class ShellBasedUnixGroupsMapping extends Configured
}
/**
+ * Check if the executor had a timeout and logs the event.
+ * @param executor to check
+ * @param user user to log
+ * @return true if timeout has occurred
+ */
+ private boolean handleExecutorTimeout(
+ ShellCommandExecutor executor,
+ String user) {
+ // If its a shell executor timeout, indicate so in the message
+ // but treat the result as empty instead of throwing it up,
+ // similar to how partial resolution failures are handled above
+ if (executor.isTimedOut()) {
+ LOG.warn(
+ "Unable to return groups for user '{}' as shell group lookup " +
+ "command '{}' ran longer than the configured timeout limit of " +
+ "{} seconds.",
+ user,
+ Joiner.on(' ').join(executor.getExecString()),
+ timeout
+ );
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Get the current user's group list from Unix by running the command 'groups'
* NOTE. For non-existing user it will return EMPTY list.
*
@@ -174,26 +200,19 @@ public class ShellBasedUnixGroupsMapping extends Configured
executor.execute();
groups = resolveFullGroupNames(executor.getOutput());
} catch (ExitCodeException e) {
- try {
- groups = resolvePartialGroupNames(user, e.getMessage(),
- executor.getOutput());
- } catch (PartialGroupNameException pge) {
- LOG.warn("unable to return groups for user {}", user, pge);
+ if (handleExecutorTimeout(executor, user)) {
return EMPTY_GROUPS;
+ } else {
+ try {
+ groups = resolvePartialGroupNames(user, e.getMessage(),
+ executor.getOutput());
+ } catch (PartialGroupNameException pge) {
+ LOG.warn("unable to return groups for user {}", user, pge);
+ return EMPTY_GROUPS;
+ }
}
} catch (IOException ioe) {
- // If its a shell executor timeout, indicate so in the message
- // but treat the result as empty instead of throwing it up,
- // similar to how partial resolution failures are handled above
- if (executor.isTimedOut()) {
- LOG.warn(
- "Unable to return groups for user '{}' as shell group lookup " +
- "command '{}' ran longer than the configured timeout limit of " +
- "{} seconds.",
- user,
- Joiner.on(' ').join(executor.getExecString()),
- timeout
- );
+ if (handleExecutorTimeout(executor, user)) {
return EMPTY_GROUPS;
} else {
// If its not an executor timeout, we should let the caller handle it
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org