Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14065#discussion_r72336372
  
    --- Diff: 
yarn/src/main/scala/org/apache/spark/deploy/yarn/security/AMCredentialRenewer.scala
 ---
    @@ -171,16 +172,30 @@ private[yarn] class AMDelegationTokenRenewer(
         val tempCreds = keytabLoggedInUGI.getCredentials
         val credentialsPath = new Path(credentialsFile)
         val dst = credentialsPath.getParent
    +    var nearestNextRenewalTime = Long.MaxValue
         keytabLoggedInUGI.doAs(new PrivilegedExceptionAction[Void] {
           // Get a copy of the credentials
           override def run(): Void = {
    -        val nearestNextTime = 
credentialManager.obtainCredentials(freshHadoopConf, tempCreds)
    -        require(nearestNextTime > System.currentTimeMillis(),
    -          s"Time of next renewal $nearestNextTime is earlier than now")
    -        timeOfNextRenewal = nearestNextTime
    +        nearestNextRenewalTime = 
credentialManager.obtainCredentials(freshHadoopConf, tempCreds)
             null
           }
         })
    +
    +    val currTime = System.currentTimeMillis()
    +    val timeOfNextUpdate = if (nearestNextRenewalTime <= currTime) {
    +      // If next renewal time is earlier than current time, we set next 
renewal time to current
    +      // time, this will trigger next renewal immediately. Also set next 
update time to current
    +      // time. There still has a gap between token renewal and update will 
potentially introduce
    +      // issue.
    --- End diff --
    
    It might be useful here to log a message here as we don't really expect 
this to happen.  If it keeps happening it could be we aren't renewing them soon 
enough.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to