Skip to content

Conversation

zhangshuyan0
Copy link

@zhangshuyan0 zhangshuyan0 commented Aug 21, 2024

Backport from master.

What changes were proposed in this pull request?

Cancel delegation token once they are used in getTokenRenewalInterval

Why are the changes needed?

When tokenRenewalInterval is not set, HadoopFSDelegationTokenProvider#getTokenRenewalInterval will fetch some tokens and renew them to get a interval value.

// Get the token renewal interval if it is not set. It will only be called once.
if (tokenRenewalInterval == null) {
tokenRenewalInterval = getTokenRenewalInterval(hadoopConf, fileSystems)
}

These tokens do not call cancel(), resulting in a large number of existing tokens on HDFS not being cleared in a timely manner, causing additional pressure on the HDFS server.

Does this PR introduce any user-facing change?

no

How was this patch tested?

manual test

Was this patch authored or co-authored using generative AI tooling?

no

@github-actions github-actions bot added the CORE label Aug 21, 2024
@HyukjinKwon
Copy link
Member

@zhangshuyan0 mind filling the PR description please? https://github.com/apache/spark/blob/master/.github/PULL_REQUEST_TEMPLATE

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-49300][CORE] Fix Hadoop delegation token leak when tokenRenewalInterval is not set. [SPARK-49300][CORE][3.5] Fix Hadoop delegation token leak when tokenRenewalInterval is not set. Aug 21, 2024
@dongjoon-hyun
Copy link
Member

@zhangshuyan0
Copy link
Author

sunchao pushed a commit that referenced this pull request Aug 22, 2024
…enewalInterval is not set

Backport from master.

### What changes were proposed in this pull request?

Cancel delegation token once they are used in `getTokenRenewalInterval`

### Why are the changes needed?

When `tokenRenewalInterval` is not set, HadoopFSDelegationTokenProvider#getTokenRenewalInterval will fetch some tokens and renew them to get a interval value.
https://github.com/apache/spark/blob/dd259b0b27841e6dd7c07f8ca3cc05d275863dd5/core/src/main/scala/org/apache/spark/deploy/security/HadoopFSDelegationTokenProvider.scala#L60-L64
These tokens do not call cancel(), resulting in a large number of existing tokens on HDFS not being cleared in a timely manner, causing additional pressure on the HDFS server.
### Does this PR introduce _any_ user-facing change?

no

### How was this patch tested?

manual test

### Was this patch authored or co-authored using generative AI tooling?

no

Closes #47823 from zhangshuyan0/branch-3.5-zsy.

Authored-by: zhangshuyan <[email protected]>
Signed-off-by: Chao Sun <[email protected]>
@sunchao
Copy link
Member

sunchao commented Aug 22, 2024

Merged to branch-3.5, thanks!

@sunchao sunchao closed this Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants