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

Raul Gutierrez Segales commented on ZOOKEEPER-2295:
---------------------------------------------------

Thanks for the patch! I think the code becomes a bit easier to read if you move 
the LOG.info statement from line 158 to have:

{code}
  if (now == nextRefresh) {
    LOG.info("Refreshing now because expiry is before next scheduled refresh 
time");
  } else if (now < nextRefresh) {
     Date until = new Date(nextRefresh);
     LOG.info("TGT refresh sleeping until: {}", until.toString());
     try {
       Thread.sleep(nextRefresh - now);
      } catch (InterruptedException ie) {
         LOG.warn("TGT renewal thread has been interrupted and will exit.");
         break;
      }
  } else {
      LOG.error("nextRefresh:{} is in the past: exiting refresh thread. Check"
           + " clock sync between this host and KDC - (KDC's clock is likely 
ahead of this host)."
           + " Manual intervention will be required for this client to 
successfully authenticate."
           + " Exiting refresh thread.", nextRefreshDate);
      break;
  }
{code}

I think it makes the intent a bit more clear. Also note the use of break 
instead of return in the else block, for consistency.

What do you think [~arshad.mohammad]?

> TGT refresh time logic is wrong
> -------------------------------
>
>                 Key: ZOOKEEPER-2295
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2295
>             Project: ZooKeeper
>          Issue Type: Bug
>    Affects Versions: 3.4.7, 3.5.1
>            Reporter: Arshad Mohammad
>            Assignee: Arshad Mohammad
>             Fix For: 3.4.8, 3.5.2, 3.6.0
>
>         Attachments: ZOOKEEPER-2295-01.patch
>
>
> When Kerberos is used as authentication mechanism some time TGT is getting 
> expired because it is not refreshed timely.
> The scenario is as follow:
> suppose now=8 (the current milliseconds)
> next refresh time= 10
> TGT expire time= 9
> *Current behaviour:* Error is logged and TGT refresh thread exits.
> *Expected behaviour:* TGT should be refreshed immediately(now) instead of 
> nextRefreshTime



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

Reply via email to