[
https://issues.apache.org/jira/browse/YARN-11489?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17721261#comment-17721261
]
ASF GitHub Bot commented on YARN-11489:
---------------------------------------
Hexiaoqiao commented on code in PR #5629:
URL: https://github.com/apache/hadoop/pull/5629#discussion_r1189569915
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/DelegationTokenRenewer.java:
##########
@@ -996,33 +996,36 @@ public void run() {
@Override
public void run() {
while (true) {
- for (Map.Entry<DelegationTokenRenewerEvent, Future<?>> entry : futures
- .entrySet()) {
- DelegationTokenRenewerEvent evt = entry.getKey();
- Future<?> future = entry.getValue();
- try {
- future.get(tokenRenewerThreadTimeout, TimeUnit.MILLISECONDS);
- } catch (TimeoutException e) {
-
- // Cancel thread and retry the same event in case of timeout
- if (future != null && !future.isDone() && !future.isCancelled()) {
- future.cancel(true);
- futures.remove(evt);
- if (evt.getAttempt() < tokenRenewerThreadRetryMaxAttempts) {
- renewalTimer.schedule(
- getTimerTask((AbstractDelegationTokenRenewerAppEvent) evt),
- tokenRenewerThreadRetryInterval);
- } else {
- LOG.info(
- "Exhausted max retry attempts {} in token renewer "
- + "thread for {}",
- tokenRenewerThreadRetryMaxAttempts,
evt.getApplicationId());
- }
+ DelegationTokenRenewerFuture dtrf;
+ try {
+ dtrf = futures.take();
+ } catch (InterruptedException e) {
+ LOG.debug("DelegationTokenRenewer pool tracker interrupted");
+ return;
+ }
+ DelegationTokenRenewerEvent evt = dtrf.getEvt();
+ Future<?> future = dtrf.getFuture();
+ try {
+ future.get(tokenRenewerThreadTimeout, TimeUnit.MILLISECONDS);
+ } catch (TimeoutException e) {
+
+ // Cancel thread and retry the same event in case of timeout
Review Comment:
Just suggest to remove the blank line. And use period at the end of the
sentences please.
> Fix memory leak of DelegationTokenRenewer futures in
> DelegationTokenRenewerPoolTracker
> --------------------------------------------------------------------------------------
>
> Key: YARN-11489
> URL: https://issues.apache.org/jira/browse/YARN-11489
> Project: Hadoop YARN
> Issue Type: Bug
> Reporter: Chun Chen
> Assignee: Chun Chen
> Priority: Major
> Labels: pull-request-available
>
> The future of DelegationTokenRenewer runnable is not removed properly
> previously, it is only removed if the runnable timeouts.
> And a Queue struct is more suitable than a Map struct for storing the futures.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]