[
https://issues.apache.org/jira/browse/CXF-9259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18131455#comment-18131455
]
Freeman Yue Fang commented on CXF-9259:
---------------------------------------
h3. Running the attached reproducer
*Requirements:* JDK 17 or later and Maven 3.8 or later.
Extract the attachment, enter the directory containing {{pom.xml}}, and run:
{code:bash}
tar -xf CXF-9259-reproducer.tar
cd <extracted-project-directory>
mvn test
{code}
The project uses CXF 4.2.4 by default. To test another version:
{code:bash}
mvn test -Dcxf.version=4.1.9
{code}
No application server, SOAP endpoint, or CXF source checkout is required.
h3. Expected results on an affected version
The build intentionally fails because the assertions describe the expected
correct behavior:
* {{defaultExpiryCachesAndFindsAnIdentifier}} passes as a baseline.
* {{closingOneCacheMustLeaveAnotherCacheUsable}} fails because closing the
first cache also closes the second cache through their shared {{CacheManager}}.
* {{explicitExpiryMustBeHonored}} fails because the entry remains present after
its supplied expiry.
The expected summary is:
{code}
Tests run: 3, Failures: 2, Errors: 0, Skipped: 0
BUILD FAILURE
{code}
> JCacheReplayCache does not respect entry expiry or shared CacheManager
> ownership
> --------------------------------------------------------------------------------
>
> Key: CXF-9259
> URL: https://issues.apache.org/jira/browse/CXF-9259
> Project: CXF
> Issue Type: Bug
> Affects Versions: 4.1.9, 4.2.4
> Reporter: Freeman Yue Fang
> Assignee: Freeman Yue Fang
> Priority: Major
> Attachments: CXF-9259-reproducer.tar
>
>
> {{JCacheReplayCache}} has two lifecycle issues:
> h3. 1. Closing one cache closes unrelated caches
> Each instance obtains the provider's shared default {{CacheManager}}, but
> {{close()}} destroys its named cache and then closes the entire manager.
> *Steps to reproduce:*
> # Create two {{CXFJCacheReplayCache}} instances with different names.
> # Add an entry to the second cache.
> # Close the first cache.
> # Access the second cache.
> *Actual result:* The second cache throws {{IllegalStateException}} because
> its cache is closed.
> *Expected result:* Closing one replay cache leaves other active caches usable.
> h3. 2. The supplied entry expiry is ignored
> {{add(identifier, expiry)}} and {{addIfAbsent(identifier, expiry)}} store the
> expiry in {{EHCacheValue}}, but the configured expiry policy always uses the
> default one-hour TTL.
> *Steps to reproduce:*
> # Insert an identifier with a short explicit expiry.
> # Wait until that expiry has passed.
> # Call {{contains(identifier)}}.
> # Attempt another {{addIfAbsent()}} for the same identifier.
> *Actual result:* The identifier remains present and reinsertion returns
> {{false}}.
> *Expected result:* Entries expire according to the supplied expiry, subject
> to the replay-cache contract's limits.
> h3. Proposed behavior
> The implementation should respect shared cache-manager ownership and apply
> per-entry expiration while preserving atomic replay checks.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)