You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Shohei Okumiya (Jira)" <ji...@apache.org> on 2026/10/19 11:24:00 UTC

[jira] [Resolved] (HIVE-30199) Fix inverted Duration.between in TokenIntrospectionAuthenticator cache expiry

     [ https://issues.apache.org/jira/browse/HIVE-30199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shohei Okumiya resolved HIVE-30199.
-----------------------------------
    Fix Version/s: 4.3.0
       Resolution: Fixed

> 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
>             Fix For: 4.3.0
>
>
> 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)