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

Jian He commented on YARN-2919:
-------------------------------

bq. assume RenewalTimerTask. run is invoked by the timer task and it has passed 
through the if (!dttr.isTimerCancelled()) but before 
renewToken(DelegationTokenToRenew) or in between renewToken & 
setTimerForTokenRenewal is invoked, removeApplicationFromRenewal gets 
triggered. In which case unnecessary renew or timer task scheduling happens

I think there's always such situation regardless whether the flag is inside the 
method (done by this patch) or outside the method ( the cancelled flag which 
exists today). e.g. In current patch, if the renew Method has passed the {{if 
(!cancelling.get()) {}} check, and before renew invokes, the cancel is 
executed, then the renewToken will also be executed ? Unless we completely 
synchronize the cancel and renew at client side which will bring more overhead, 
it is possible for a renew happen immediately after a cancel. 

On the other hand, it is possible, but rare, for the mentioned scenario to 
occur because {{dttr.cancelTimer();}} will cancel the timer and the followup 
cancelToken(dttr) doesnot cancel the token immediately, but rather enqueues the 
cancel the task which should have more room for the other parallel executing 
renewal thread to run into completion.

Anyway, we could try to synchronize both operations completely to avoid this 
rare scenario but at the cost of more overhead,  or we have a good fallback 
code to handle this failed scenario as it does today. (btw, do you know if this 
issue occur in reality or it's a observation by code?) IMHO, the current 
existing way maybe fine..



> Potential race between renew and cancel in DelegationTokenRenwer 
> -----------------------------------------------------------------
>
>                 Key: YARN-2919
>                 URL: https://issues.apache.org/jira/browse/YARN-2919
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: security
>    Affects Versions: 2.6.0
>            Reporter: Karthik Kambatla
>            Assignee: Naganarasimha G R
>            Priority: Critical
>         Attachments: YARN-2919.002.patch, YARN-2919.003.patch, 
> YARN-2919.004.patch, YARN-2919.005.patch, YARN-2919.20141209-1.patch
>
>
> YARN-2874 fixes a deadlock in DelegationTokenRenewer, but there is still a 
> race because of which a renewal in flight isn't interrupted by a cancel. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to