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

Quarkus caches Failures #39677

Closed
wesleysalimansdvb opened this issue Mar 25, 2024 · 5 comments · Fixed by #39762
Closed

Quarkus caches Failures #39677

wesleysalimansdvb opened this issue Mar 25, 2024 · 5 comments · Fixed by #39762
Labels
area/cache kind/bug Something isn't working
Milestone

Comments

@wesleysalimansdvb
Copy link
Contributor

wesleysalimansdvb commented Mar 25, 2024

Describe the bug

Whenever a failure occurs such as a Timeout this failure is cached, so each subsequent call will retrieve this failure from cache (and the remote service is not called, until the cache is invalidated).

Expected behavior

Quarkus does not cache the failure.

Actual behavior

Quarkus caches the failure and each subsequent call for that cache key get the failure from cache (the remote service is not called)

How to Reproduce?

@CacheResult(cacheName = "username")
  public Uni<String> getUsernameById(String userId) {
    return remoteApi
        .getUser(userId)
        .onFailure()
        .invoke(failure -> Log.error("Error when getUsername", failure))
        .onItem()
        .transform(User::getName);
  }

Output of uname -a or ver

Darwin REDACTED 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk 21.0.1 2023-10-17 LTS OpenJDK Runtime Environment Corretto-21.0.1.12.1 (build 21.0.1+12-LTS) OpenJDK 64-Bit Server VM Corretto-21.0.1.12.1 (build 21.0.1+12-LTS, mixed mode, sharing)

Quarkus version or git rev

3.9.0.CR1

Build tool (ie. output of mvnw --version or gradlew --version)

maven

Additional information

No response

@wesleysalimansdvb wesleysalimansdvb added the kind/bug Something isn't working label Mar 25, 2024
Copy link

quarkus-bot bot commented Mar 25, 2024

/cc @gwenneg (cache)

@gsmet
Copy link
Member

gsmet commented Mar 25, 2024

@gwenneg could you have a look?

Now I'm not entirely sure that's something we can fix without introducing an annotation to specify the behavior as caching the failure could be a valid behavior too.

@stefvanderweldevolksbanknl
Copy link
Contributor

@gwenneg could you have a look?

Now I'm not entirely sure that's something we can fix without introducing an annotation to specify the behavior as caching the failure could be a valid behavior too.

It doesn't seem logical to me that failures are cached, but Exceptions are not.

@wesleysalimansdvb
Copy link
Contributor Author

And if this is expected behaviour, what would be the recommended way to ensure that subsequent calls of a failed request do call the remote service and don't get the cached failure?

geoand added a commit to geoand/quarkus that referenced this issue Mar 28, 2024
@geoand
Copy link
Contributor

geoand commented Mar 28, 2024

I consider this behavior incorrect and have opened #39762 to address it.

geoand added a commit to geoand/quarkus that referenced this issue Mar 28, 2024
geoand added a commit that referenced this issue Mar 28, 2024
Ensure that failed unis are not cached
@quarkus-bot quarkus-bot bot added this to the 3.10 - main milestone Mar 28, 2024
karesti pushed a commit to karesti/quarkus that referenced this issue Mar 29, 2024
@gsmet gsmet modified the milestones: 3.10 - main, 3.8.4 Apr 2, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Apr 2, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Apr 2, 2024
@gsmet gsmet modified the milestones: 3.8.4, 3.9.2 Apr 11, 2024
ketola pushed a commit to ketola/quarkus that referenced this issue May 1, 2024
@gsmet gsmet modified the milestones: 3.9.2, 3.8.5 May 15, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cache kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants