You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by pr...@apache.org on 2020/12/30 08:45:31 UTC

[zeppelin] branch master updated: [ZEPPELIN-5176] Kerberos ticket renewal fix in JDBC Interpreter

This is an automated email from the ASF dual-hosted git repository.

prabhjyotsingh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/master by this push:
     new f188b40  [ZEPPELIN-5176] Kerberos ticket renewal fix in JDBC Interpreter
f188b40 is described below

commit f188b40d5b0f8bdf1564164b78bfaf73e27d6e25
Author: Vipin Rathor <v....@gmail.com>
AuthorDate: Thu Dec 24 22:53:11 2020 -0800

    [ZEPPELIN-5176] Kerberos ticket renewal fix in JDBC Interpreter
    
    ### What is this PR for?
    This PR addresses a problem in JDBC Interpreter where the Kerberos ticket renewal thread and the interpret() function vies for Kerberos ticket during Interpreter initialization and later on, during the ticket renewal, which can lead to an expired ticket intermittently.
    This PR fixes Kerberos ticket renewal logic in JDBC interpreter:
    1. Initialize UGI before using it in runKerberosLogin()
    2. Wait 1 second between every call to runKerberosLogin()
    
    ### What type of PR is it?
    [Bug Fix]
    
    ### Todos
    * none
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-5176
    
    ### How should this be tested?
    * Manual testing on a cluster. Configure JDBC interpreter with Kerberos enabled and make sure that the ticket is valid after the expiration time
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Vipin Rathor <v....@gmail.com>
    
    Closes #4001 from VipinRathor/ZEPPELIN-5176 and squashes the following commits:
    
    82c7f75cb [Vipin Rathor] ZEPPELIN-5176 Kerberos ticket renewal fix in JDBC Interpreter
---
 jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java      | 4 ++++
 .../java/org/apache/zeppelin/interpreter/KerberosInterpreter.java     | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
index d63358b..1ff77f2 100644
--- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
+++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
@@ -182,6 +182,10 @@ public class JDBCInterpreter extends KerberosInterpreter {
 
   @Override
   protected boolean runKerberosLogin() {
+    // Initialize UGI before using
+    Configuration conf = new org.apache.hadoop.conf.Configuration();
+    conf.set("hadoop.security.authentication", KERBEROS.toString());
+    UserGroupInformation.setConfiguration(conf);
     try {
       if (UserGroupInformation.isLoginKeytabBased()) {
         UserGroupInformation.getLoginUser().reloginFromKeytab();
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java
index 9c2353b..d00e962 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java
@@ -146,7 +146,8 @@ public abstract class KerberosInterpreter extends AbstractInterpreter {
             logger.error("runKerberosLogin failed for  max attempts, calling close interpreter.");
             close();
           } else {
-            scheduledExecutorService.submit(this);
+            // wait for 1 second before calling runKerberosLogin() again
+            scheduledExecutorService.schedule(this, 1, TimeUnit.SECONDS);
           }
         }
         return null;