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

Manfred Baedke updated OAK-12326:
---------------------------------
    Fix Version/s: 2.6.0

> Flacky test TokenCleanupTest#testBatchSizeLimitsCleanup
> -------------------------------------------------------
>
>                 Key: OAK-12326
>                 URL: https://issues.apache.org/jira/browse/OAK-12326
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: security
>            Reporter: Dikran Seropian
>            Assignee: Manfred Baedke
>            Priority: Major
>             Fix For: 2.6.0
>
>
> In 
> [https://github.com/apache/jackrabbit-oak/blob/03499ab99de715f054b3ed0e9787c928d9fb2858/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenCleanupTest.java#L100]
>  
> {code:java}
> org.apache.jackrabbit.oak.security.authentication.token.TokenCleanupTest#testBatchSizeLimitsCleanup{code}
>  
>  
> TokenProviderImpl.cleanupExpired runs opportunistically on every createToken 
> call whenever shouldRunCleanup(token) is true (~1/8 random chance).
>  
> In the test, the cleanup threshold (5) equaled the number of expired tokens 
> created, so the 5th expired-token creation could randomly trigger an extra 
> cleanup batch. When that happened, two batches ran and all 5 expired tokens 
> were removed instead of only batchSize (3), producing the intermittent 
> failure.
>  
> The fix would be to raise the cleanup threshold to expiredCount + 1 so 
> cleanup can never fire during the expired-token creation phase, guaranteeing 
> exactly one cleanup batch during the extras loop. This makes the batch-size 
> assertion deterministic.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to