Skip to content

Feign Retryer is not configurable and overlaps with the ribbon retry. #467

Closed
@LutzStrobel

Description

@LutzStrobel

I have a consumer service calling an provider service which is running with 2 instances.
The provider interface

  @FeignClient("example")
  public interface ExampleService {
     @RequestMapping(
        method = {RequestMethod.POST},
        value = {"/greeting/{nameToGreat}"}
      )
     String greeting(@PathVariable(value = "nameToGreat") String nameToGreat);

The ribbon configuration within the consumer service is as follows:

example.ribbon.OkToRetryOnAllOperations=false
example.ribbon.ReadTimeout=3999
example.ribbon.MaxAutoRetries=0
example.ribbon.MaxAutoRetriesNextServer=3

If there is a SocketTimeoutException during a call to the example service, I would not expect that there a retry to the next instance occurs, because POST requests are not idempotent.
But the real behavior is that there retries to the next instance occurs which causes creation of duplicate accounts aso.

In a debugging session I could see that a correct RequestSpecificRetryHandler with the ribbon config values from above will be created and as far I could see the method isRetriableException(...) of that handler returns false.

What can I do to find a solution?
Thanx
Lutz

Activity

LutzStrobel

LutzStrobel commented on Jul 29, 2015

@LutzStrobel
Author

Now I found that the FeignClient uses the default retryer which retries the failed requests on its own.
I think this is not desired, because it overrules the configuration for the ribbon loadbalancer.
Maybe this is not a feature, is it?
Lutz

changed the title [-]LoadBalancerCommand retries post requests even if configured: OkToRetryOnAllOperations=false[/-] [+]Feign Retryer is not configurable and overlaps with the ribbon retry.[/+] on Mar 3, 2016
spencergibb

spencergibb commented on Mar 3, 2016

@spencergibb
Member

Perhaps the default should be an empty Retryer.

As a workaround, you can create a Retryer bean in a Feign Client Configuration.

padilo

padilo commented on Apr 25, 2016

@padilo

Workaround works like a charm:

  @Bean
  public Retryer retryer() {
    return new Retryer() {

      @Override
      public void continueOrPropagate(RetryableException e) {
        throw e;
      }

      @Override
      public Retryer clone() {
        return this;
      }
    };
  }
srowatt

srowatt commented on Apr 6, 2017

@srowatt

There's a NEVER_RETRY implementation so you can do

@Bean public Retryer retryer() { return Retryer.NEVER_RETRY; }

ryanjbaxter

ryanjbaxter commented on Apr 6, 2017

@ryanjbaxter
Contributor

We can close this issue because all this retry logic was simplified in the latest Camden SRs and and Dalston snapshots and there is only one level of retry now.

theknickerbocker

theknickerbocker commented on Jul 18, 2017

@theknickerbocker

Can you explain what you mean by 'there is only one level of retry now'?

spencergibb

spencergibb commented on Jul 18, 2017

@spencergibb
Member

We've eliminated the feign retry with our ribbon retry

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ryanjbaxter@spencergibb@padilo@LutzStrobel@srowatt

        Issue actions

          Feign Retryer is not configurable and overlaps with the ribbon retry. · Issue #467 · spring-cloud/spring-cloud-netflix