Skip to content

Fix failsafe composition and update README - #1872

Open
rameshmalla wants to merge 3 commits into
zalando:mainfrom
rameshmalla:main
Open

Fix failsafe composition and update README#1872
rameshmalla wants to merge 3 commits into
zalando:mainfrom
rameshmalla:main

Conversation

@rameshmalla

Copy link
Copy Markdown
Member

Fixes #1859.

Description

Merges the four separate per-policy FailsafePlugin instances (retry, circuit-breaker,
backup-request, timeout) that riptide-spring-boot-autoconfigure registered per client into a
single FailsafePlugin per client, sharing one Policy list and one executor.

Key changes:

  • FailsafePluginFactory: replaced createRetryFailsafePlugin / createCircuitBreakerPlugin /
    createBackupRequestPlugin / createTimeoutPlugin with one createFailsafePlugin(...) that
    builds a combined List<RequestPolicy> (timeout → backup-request → retry → circuit-breaker)
    and applies it via a new FailsafePlugin.withPolicies(List<RequestPolicy>) method
    (riptide-failsafe).
  • DefaultRiptideRegistrar: replaced the four separate
    register*FailsafePlugin(...) methods with registerFailsafePluginWithConfiguredPolicies(...),
    which registers one FailsafePlugin bean per client whenever any of
    retry/circuit-breaker/backup-request/timeouts is enabled, and wires the (now optional) circuit
    breaker bean into it directly.
  • Introduced a single, unified thread pool config riptide.clients.<id>.failsafe.threads, shared
    by all four policies on a client. The old per-policy retry.threads /
    circuit-breaker.threads / backup-request.threads / timeouts.threads settings are no
    longer supported — configuring any of them now fails fast at startup with a new
    LegacyFailsafeThreadsException pointing at the replacement property.
  • Updated RiptideProperties/Defaulting to add the new Failsafe/threads config, and updated
    tests (FailSafeExecutorAutoConfigurationTest, PluginTest) and the
    riptide-spring-boot-autoconfigure README accordingly.

Motivation and Context

Having four independent Failsafe instances per client (one per policy) meant their internal
guards/executors didn't coordinate with each other, which could lead to deadlocks under
concurrent retry/circuit-breaker/backup-request/timeout execution on the same request. Merging
them into a single FailsafePlugin with one shared executor fixes that coordination problem.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to change)
    — legacy per-policy *.threads settings now throw an exception at startup instead of being silently honored.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

Signed-off-by: Ramesh Malla <ramesh.malla6@gmail.com>
Signed-off-by: Ramesh Malla <ramesh.malla6@gmail.com>
@rameshmalla
rameshmalla marked this pull request as ready for review September 1, 2026 09:39
@lukasniemeier-zalando lukasniemeier-zalando added the minor Minor changes, e.g. low risk config updates, changes that do not introduce a new API call. label Sep 3, 2026
@fatroom

fatroom commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

👍

1 similar comment
@rameshmalla

Copy link
Copy Markdown
Member Author

👍

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

Labels

minor Minor changes, e.g. low risk config updates, changes that do not introduce a new API call.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Riptide creates a new FailsafePlugin and Failsafe instance per policy, bypassing Failsafe’s policy chaining and deadlock protection

3 participants