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

Spring Retry - Recover method not getting called in case of Exception Assault on Service class #395

Open
bunty-raghani opened this issue Sep 11, 2023 · 1 comment

Comments

@bunty-raghani
Copy link

bunty-raghani commented Sep 11, 2023

When Spring Retry is configured in project with recover/fallback method, in case of exception assault on service class, fallback method/recover method is not getting called.

NOTE: In case of service assault, retry functionality is working fine but fallback method is not getting called at the end.

Expected Behavior

Recover method should be called in case of service assault.

Current Behavior

Only retry functionality is working fine but when retries are exhausted then at the end recover method is not getting called.
(Already cross checked the recover method signature. Same is working fine in case of RestTeamplate assault but it is not working in case of service Assault.)

Steps to Reproduce

  1. Create a service class with a method and configure spring retry using @retryable annotation. Specify the exception type for which retry should be performed and number of time the retry should be performed.
  2. In the same service class, create a recover method using @recover annotation, specify the same exception inside method signature for which retry was configured in step-1.
  3. Enable exception assault on service class
  4. During the assault, notice that the retry functionality is working fine but recover method is not getting called when retries are exhausted.

Context (Environment)

This will be helpful to test the real world scenarios in which fallback methods are called when retries are exhausted.

@bunty-raghani bunty-raghani changed the title Spring Retry - Recover method not getting called in case of Service Assault Spring Retry - Recover method not getting called in case of Exception Assault on Service class Sep 11, 2023
@F43nd1r
Copy link
Member

F43nd1r commented Sep 29, 2023

Chaosmonkey always attacks whole classes, so a recover in the same service cannot work because the recover function itself will also be attacked.
I suppose the improvement here would be to somehow allow a configuration to ignore that method (name based/annotation based?)

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

No branches or pull requests

2 participants