[ 
https://issues.apache.org/jira/browse/HDFS-15960?focusedWorklogId=580360&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-580360
 ]

ASF GitHub Bot logged work on HDFS-15960:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Apr/21 21:49
            Start Date: 09/Apr/21 21:49
    Worklog Time Spent: 10m 
      Work Description: goiri commented on a change in pull request #2887:
URL: https://github.com/apache/hadoop/pull/2887#discussion_r610921207



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/NamenodeHeartbeatService.java
##########
@@ -170,7 +172,20 @@ protected void serviceInit(Configuration configuration) 
throws Exception {
 
   @Override
   public void periodicInvoke() {
-    updateState();
+    try {
+      SecurityUtil.doAsCurrentUser(
+          new PrivilegedExceptionAction<Object>() {

Review comment:
       Can this be a lambda?

##########
File path: 
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/NamenodeHeartbeatService.java
##########
@@ -170,7 +172,20 @@ protected void serviceInit(Configuration configuration) 
throws Exception {
 
   @Override
   public void periodicInvoke() {
-    updateState();
+    try {
+      SecurityUtil.doAsCurrentUser(
+          new PrivilegedExceptionAction<Object>() {
+            @Override
+            public Object run() {
+              updateState();
+              return null;
+            }
+          });
+    } catch (IOException e) {
+      // Generic error that we don't know about
+      LOG.error("Unexpected exception while communicating with {}: {}",

Review comment:
       Can we have a unit test for this?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 580360)
    Time Spent: 0.5h  (was: 20m)

> Router NamenodeHeartbeatService fails to authenticate with namenode in a 
> kerberized envi
> ----------------------------------------------------------------------------------------
>
>                 Key: HDFS-15960
>                 URL: https://issues.apache.org/jira/browse/HDFS-15960
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Borislav Iordanov
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> We use http.hadoop.authentication.type = "kerberos" and when the 
> NamenodeHeartbeatService calls the namenode via JMX, it is not providing a 
> user security context so the authentication token is not transmitted and it 
> fails.  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to