[
https://issues.apache.org/jira/browse/HIVE-30199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18128707#comment-18128707
]
Shohei Okumiya commented on HIVE-30199:
---------------------------------------
I merged this one.
https://github.com/apache/hive/pull/6892
> Fix inverted Duration.between in TokenIntrospectionAuthenticator cache expiry
> -----------------------------------------------------------------------------
>
> Key: HIVE-30199
> URL: https://issues.apache.org/jira/browse/HIVE-30199
> Project: Hive
> Issue Type: Bug
> Reporter: Raghav Aggarwal
> Assignee: Raghav Aggarwal
> Priority: Major
> Labels: pull-request-available
>
> In {{{}TokenIntrospectionAuthenticator{}}},the calculation for the token
> lifespan in {{expireAfterCreate}} and {{expireAfterUpdate}} has its
> parameters inverted:
> {code:java}
> final var expiresIn = Duration.between(value.getExpirationTime().toInstant(),
> clock.instant());
> return Math.min(expiresIn.toNanos(), maxExpiration.toNanos());{code}
> Because java.time.Duration.between(start, end) evaluates to end - start:
> • It computes clock.instant() - expirationTime which evaluated to a
> negative duration
> • Per Caffeine's Expiry contract, any duration ≤ 0 instructs the cache to
> expire and evict the entry immediately.
> This means the cache would lead to 100% miss rate
--
This message was sent by Atlassian Jira
(v8.20.10#820010)