[ 
https://issues.apache.org/jira/browse/HADOOP-12741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15119100#comment-15119100
 ] 

Vinayakumar B commented on HADOOP-12741:
----------------------------------------

I am seeing this part, which creates the thread and starts it, but this is 
called from {{UGI#loginUserFromSubject(..)}}
{code}        Thread t = new Thread(new Runnable() {
          
          @Override
          public void run() {
            String cmd = conf.get("hadoop.kerberos.kinit.command",
                                  "kinit");
            KerberosTicket tgt = getTGT();
            if (tgt == null) {
              return;
            }
            long nextRefresh = getRefreshTime(tgt);
            while (true) {
              try {
                long now = Time.now();
                if(LOG.isDebugEnabled()) {
                  LOG.debug("Current time is " + now);
                  LOG.debug("Next refresh is " + nextRefresh);
                }
                if (now < nextRefresh) {
                  Thread.sleep(nextRefresh - now);
                }
                Shell.execCommand(cmd, "-R");
                if(LOG.isDebugEnabled()) {
                  LOG.debug("renewed ticket");
                }
                reloginFromTicketCache();
                tgt = getTGT();
                if (tgt == null) {
                  LOG.warn("No TGT after renewal. Aborting renew thread for " +
                           getUserName());
                  return;
                }
                nextRefresh = Math.max(getRefreshTime(tgt),
                                       now + MIN_TIME_BEFORE_RELOGIN);
              } catch (InterruptedException ie) {
                LOG.warn("Terminating renewal thread");
                return;
              } catch (IOException ie) {
                LOG.warn("Exception encountered while running the" +
                    " renewal command. Aborting renew thread. " + ie);
                return;
              }
            }
          }
        });
        t.setDaemon(true);
        t.setName("TGT Renewer for " + getUserName());
        t.start();{code}

> UserGroupInformation.loginUserFromKeytab() creates background thread which is 
> not getting killed even after application exited
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-12741
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12741
>             Project: Hadoop Common
>          Issue Type: New Feature
>          Components: security
>    Affects Versions: 2.6.3
>            Reporter: Umesh K
>
> Hi UserGroupInformation.loginUserFromKeytab() method creates one background 
> thread for keytab refresh after every 10 hours I guess. One of my application 
> is using UserGroupInformation.loginUserFromKeytab() but at the end of my 
> application the background thread created by it does not get killed it keeps 
> on running. How do I kill/stop thead started by 
> UserGroupInformation.loginUserFromKeytab()? Please guide or please provide 
> method inside UserGroupInformation so that we can kill it or stop it. Thanks 
> in advance. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to