Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache get error handler execute twice #681

Open
fureq opened this issue Feb 17, 2022 · 2 comments
Open

Cache get error handler execute twice #681

fureq opened this issue Feb 17, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@fureq
Copy link

fureq commented Feb 17, 2022

Describe the bug
During getting elements from cache, annotated by @Cacheable on FeignClient, cache get error handler execute twice.
It looks like it is caused by change #608. The flow seems to be as follows:

-> CacheInterceptor
   -> CacheAspectSupport#execute:402 (findCachedItem)
      -> handleCacheGetError 
   -> CacheAspectSupport#execute:421 (invokeOperation)
      -> FeignCachingInvocationHandlerFactory#create:53 (cacheInterceptor.invoke)
         -> CacheAspectSupport#execute:402 (findCachedItem) 
            -> handleCacheGetError

Affected spring cloud version: 2021.0.0

Sample
Sample application that reproduces the problem: https://github.com/fureq/spring-feign-bug. Details are described in readme.

@OlgaMaciaszek
Copy link
Collaborator

Hello @fureq, thanks for reporting the issue and providing a sample. I was able to reproduce this.

@OlgaMaciaszek OlgaMaciaszek added bug Something isn't working and removed in progress labels Feb 25, 2022
@zhangt2333
Copy link

zhangt2333 commented Jul 30, 2024

In my project, I just set spring.cloud.openfeign.cache.enabled=false (feign.cache.enabled=false in spring-cloud-openfeign-core-3.1.0.jar) to disable twice cache operations. The org.springframework.cache.interceptor.CacheInterceptor (created at org.springframework.cache.annotation.ProxyCachingConfiguration#cacheInterceptor) already supports the @Cacheable annotation on methods within classes annotated with @FeignClient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants