فهرست منبع

HADOOP-10562. Namenode exits on exception without printing stack trace in AbstractDelegationTokenSecretManager. (Contributed by Suresh Srinivas)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1@1592647 13f79535-47bb-0310-9956-ffa450edef68
Arpit Agarwal 11 سال پیش
والد
کامیت
5e9a5e7feb
2فایلهای تغییر یافته به همراه15 افزوده شده و 16 حذف شده
  1. 4 0
      CHANGES.txt
  2. 11 16
      src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java

+ 4 - 0
CHANGES.txt

@@ -211,6 +211,10 @@ Release 1.3.0 - unreleased
     HDFS-6141. WebHdfsFileSystem#toUrl does not perform character escaping.
     (cnauroth)
 
+    HADOOP-10562. Namenode exits on exception without printing stack trace
+    in AbstractDelegationTokenSecretManager. (Suresh Srinivas via
+    Arpit Agarwal)
+
 Release 1.2.2 - unreleased
 
   INCOMPATIBLE CHANGES

+ 11 - 16
src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java

@@ -252,22 +252,19 @@ extends AbstractDelegationTokenIdentifier>
     DataInputStream in = new DataInputStream(buf);
     TokenIdent id = createIdentifier();
     id.readFields(in);
-    LOG.info("Token renewal requested for identifier: "+id);
+    LOG.info("Token renewal for identifier: " + id + "; total currentTokens "
+        + currentTokens.size());
     
     if (id.getMaxDate() < now) {
-      throw new InvalidToken("User " + renewer + 
-                             " tried to renew an expired token");
+      throw new InvalidToken(renewer + " tried to renew an expired token");
     }
     if ((id.getRenewer() == null) || ("".equals(id.getRenewer().toString()))) {
-      throw new AccessControlException("User " + renewer + 
-                                       " tried to renew a token without " +
-                                       "a renewer");
+      throw new AccessControlException(renewer + 
+          " tried to renew a token without a renewer");
     }
     if (!id.getRenewer().toString().equals(renewer)) {
-      throw new AccessControlException("Client " + renewer + 
-                                       " tries to renew a token with " +
-                                       "renewer specified as " + 
-                                       id.getRenewer());
+      throw new AccessControlException(renewer + 
+          " tried to renew a token with renewer " + id.getRenewer());
     }
     DelegationKey key = allKeys.get(id.getMasterKeyId());
     if (key == null) {
@@ -278,8 +275,8 @@ extends AbstractDelegationTokenIdentifier>
     }
     byte[] password = createPassword(token.getIdentifier(), key.getKey());
     if (!Arrays.equals(password, token.getPassword())) {
-      throw new AccessControlException("Client " + renewer
-          + " is trying to renew a token with " + "wrong password");
+      throw new AccessControlException(renewer
+          + " is trying to renew a token with wrong password");
     }
     long renewTime = Math.min(id.getMaxDate(), now + tokenRenewInterval);
     DelegationTokenInformation info = new DelegationTokenInformation(renewTime,
@@ -319,8 +316,7 @@ extends AbstractDelegationTokenIdentifier>
       throw new AccessControlException(canceller
           + " is not authorized to cancel the token");
     }
-    DelegationTokenInformation info = null;
-    info = currentTokens.remove(id);
+    DelegationTokenInformation info = currentTokens.remove(id);
     if (info == null) {
       throw new InvalidToken("Token not found");
     }
@@ -420,8 +416,7 @@ extends AbstractDelegationTokenIdentifier>
           }
         }
       } catch (Throwable t) {
-        LOG.error("ExpiredTokenRemover thread received unexpected exception. "
-            + t);
+        LOG.error("ExpiredTokenRemover thread received unexpected exception", t);
         Runtime.getRuntime().exit(-1);
       }
     }