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

Resilience4JCircuitBreaker not able to consistently interrupt Timelimiter tasks. #230

Closed
gatewaynovice opened this issue Dec 18, 2024 · 5 comments

Comments

@gatewaynovice
Copy link

I'm using spring-cloud-circuitbreaker with Resilience4j, using Circuitbreaker, Timelimiter, ThreadpoolBukhead components of Resilience4j . Timelimiter is configured to timeout after 15 seconds on any of my requests. Requests correctly timeout after 15 seconds and a TimeoutException is thrown to the clients, but the thread processing the backend response continues running and waits until it gets back a response from the backend.

Versions being used:

Spring: 6.2.1
Spring Boot: 3.4.0
Spring Cloud Dependencies: 2024.0.0
Spring Cloud CircuitBreaker: 3.2.0
Resilience4j: 2.2.0

TimeLimiter config being used in application.yaml:

resilience4j.timelimiter:
configs:
default:
timeoutDuration: 16s
cancelRunningFuture: true
metrics:
enabled: true

Note: I'm not using annotations to use the Circuitbreaker or the Timelimiter, my application code makes the calls directly.

Debugging info:

I debugged the code in Resilience4JCircuitBreaker and TimeLimiterImpl. It looks like "FutureTask" associated with the Timelimiter is correctly being set to to be interrupted but its not being honored. I' not sure if the issue is in Resiliece4j Timelimiter module or Sping CLouds Resilience4JCircuitBreaker.

Thanks,
GatewayNovice

@ryanjbaxter
Copy link
Contributor

@gatewaynovice
Copy link
Author

Thanks Ryan for the response. That test makes sense to me. What I'm observing in my testing is that the thread is marked interrupted but continues to run. It's inconsistent behavior though.

Here is the code below TimelimiterImpl does get called which marks the thread as Interrupted, but the thread continues to wait for the backend response. Main concern here is with capacity, if the thread does not get freed up it wont be freed up to handle other requests.

https://github.com/resilience4j/resilience4j/blob/master/resilience4j-timelimiter/src/main/java/io/github/resilience4j/timelimiter/internal/TimeLimiterImpl.java#L54

@ryanjbaxter
Copy link
Contributor

Can you provide me some sample code that demonstrates the problem?

@spring-cloud-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-cloud-issues
Copy link

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants