-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDFS-17849 : Fix for Namenode crashed while cleaning up Expired Delegation tokens of older realm #8054
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
base: trunk
Are you sure you want to change the base?
HDFS-17849 : Fix for Namenode crashed while cleaning up Expired Delegation tokens of older realm #8054
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -858,7 +858,12 @@ private void removeExpiredToken() throws IOException { | |
| long renewDate = entry.getValue().getRenewDate(); | ||
| if (renewDate < now) { | ||
| expiredTokens.add(entry.getKey()); | ||
| removeTokenForOwnerStats(entry.getKey()); | ||
| try { | ||
| removeTokenForOwnerStats(entry.getKey()); | ||
| } catch (Exception e) { | ||
|
||
| LOG.warn("Ignoring the exception in removeTokenForOwnerStats to remove expired " + | ||
| "delegation tokens from cache and proceeding to remove", e); | ||
| } | ||
| i.remove(); | ||
| } | ||
| } | ||
|
|
||
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.
Thanks @arunreddyav for your report and contribution, I am a little confused the token could be leak when thrown exception here. I think the smooth way is config the
hadoop.security.auth_to_localwhen change the realm. What do you think about? Thanks again.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.
logExpireTokens(expiredTokens);.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.
tokenOwnerStatscould not be clean, this is one nit issue.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.
Thanks for the review @Hexiaoqiao . Our customers create cluster does a sample job checks with local kerberoes. Once initial setup is done they will configure LDAP/Active Directory through Ambari . Once AD realm is configured they can not keep old realm based auth rules as its against the security
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.
Agree to add this try-catch into
removeTokenForOwnerStatsand make suretokenOwnerStatsalso can be clean even when meet some auth issue and it's better to leave some annotation.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.
@arunreddyav, I have a question, similar to what @Hexiaoqiao mentioned: how are we handling the cleanup of tokenOwnerStats in exception cases? Could you check if the following idea makes sense?
We need to ensure that tokenOwnerStats is cleaned up when an exception occurs. To do this, we should try to obtain the real user from the token identity, like so:
Let's introduce a new
removeTokenForOwnerStats(String)method, for example: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.
Thanks for the review, @surendralilhore.
entry.getKey().getRealUser().toString()will be empty for older realm tokens, so this approach may not work in those cases.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.
@Hexiaoqiao , any thoughts on how to clean the old token owner stats ?