-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
HADOOP-19401: Improve error message when OS can't identify the current user. #7325
Conversation
Unfortunately, I think we're stuck with string matching logic on this. There isn't a more specific exception type to detect. The |
Pre-submit will give this a -1 for no new tests. I don't see a good way to write a unit test for it. It would probably end up relying on things like Docker or elevated permissions that aren't guaranteed to be in place on everyone's CI hosts. |
💔 -1 overall
This message was automatically generated. |
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.
LGTM
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
+1 |
…t user. Closes #7325 Signed-off-by: Shilun Fan <[email protected]> Signed-off-by: Steve Loughran <[email protected]> Signed-off-by: Ayush Saxena <[email protected]> (cherry picked from commit b6916eb)
…t user. Closes #7325 Signed-off-by: Shilun Fan <[email protected]> Signed-off-by: Steve Loughran <[email protected]> Signed-off-by: Ayush Saxena <[email protected]> (cherry picked from commit b6916eb) (cherry picked from commit 7d699e5)
I committed this to trunk, branch-3.4 and branch-3.3. @slfan1989 , @steveloughran , @ayushtkn , thanks for the reviews! |
Description of PR
Under simple auth, UGI identifies the current Hadoop user as the OS user. If the OS can't determine the user, then they receive a cryptic
KerberosAuthException
, even though Kerberos auth isn't really configured. I've seen this come up for Hadoop processes launched in Docker containers that accidentally specify a UID that's not actually present in the image. We can improve this error so that users have a better understanding of how to fix the problem.Here is how the Unix user identification flows through the JDK:
https://github.com/openjdk/jdk11u-dev/blob/master/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixPrincipal.java#L65
https://github.com/openjdk/jdk11u-dev/blob/master/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixLoginModule.java#L129
https://github.com/openjdk/jdk11u-dev/blob/master/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixSystem.java#L55
Ultimately, this is just delegating to native syscalls to
getuid
andgetpwuid
:https://github.com/openjdk/jdk11u-dev/blob/master/src/jdk.security.auth/unix/native/libjaas/Unix.c#L82
How was this patch tested?
One easy way to reproduce this problem is to exec inside the dev container with a non-existent UID:
Then, run UGI's main entry point:
This is problematic for two reasons:
NullPointerException
from the JDK doesn't point the user toward how to fix the problem.KerberosAuthException
actually misleads people into thinking it's a Kerberos problem, even though this is simple auth.After the patch, the error indicates a problem with the UID and avoids mentioning Kerberos. This will point users in the right direction of looking at problems with their OS user.
For code changes:
LICENSE
,LICENSE-binary
,NOTICE-binary
files?