Skip to content

Commit b6916eb

Browse files
committed
HADOOP-19401: Improve error message when OS can't identify the current user.
Closes #7325 Signed-off-by: Shilun Fan <[email protected]> Signed-off-by: Steve Loughran <[email protected]> Signed-off-by: Ayush Saxena <[email protected]>
1 parent 6370cd2 commit b6916eb

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UGIExceptionMessages.java

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ final class UGIExceptionMessages {
2727
public static final String FOR_USER = " for user: ";
2828
public static final String FOR_PRINCIPAL = " for principal: ";
2929
public static final String FROM_KEYTAB = " from keytab ";
30+
public static final String INVALID_UID = "Invalid UID, could not determine effective user";
3031
public static final String LOGIN_FAILURE = "Login failure";
3132
public static final String LOGOUT_FAILURE = "Logout failure";
3233
public static final String MUST_FIRST_LOGIN =

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java

+6
Original file line numberDiff line numberDiff line change
@@ -2075,6 +2075,12 @@ private static UserGroupInformation doSubjectLogin(
20752075
}
20762076
return ugi;
20772077
} catch (LoginException le) {
2078+
String msg = le.getMessage();
2079+
if (msg != null && msg.contains("invalid null input")) {
2080+
// This error from the JDK indicates that the OS couldn't map the UID of this process to an
2081+
// actual user. Throw this as an IOException, because it's not related to Kerberos.
2082+
throw new IOException(INVALID_UID, le);
2083+
}
20782084
KerberosAuthException kae =
20792085
new KerberosAuthException(FAILURE_TO_LOGIN, le);
20802086
if (params != null) {

0 commit comments

Comments
 (0)