Skip to content

Retrofit client can’t have responseTimeout set longer than 15 seconds #6385

Description

@kasecato

When I combine RetryingClient with a responseTimeout in ArmeriaRetrofit, any response timeout value over 15 seconds is ignored even if the retry rule isn't triggered

public class Main {
    public static void main(String[] args) {
        final var exampleClient = ArmeriaRetrofit
                .builder("http://localhost:18080")
                .decorator(LoggingClient.newDecorator())
                // Any timeout longer than 15 seconds is ignored
                .responseTimeout(Duration.ofSeconds(20L)) // <- ignored
                // And RetryingClient’s timeout setting takes effect instead
                .decorator(RetryingClient.newDecorator(
                        RetryConfig.builder(RetryRule.builder()
                                                     .onException(NotImplementedError.class)
                                                     .thenNoRetry())
                                   .build()))
                .addConverterFactory(JacksonConverterFactory.create(new ObjectMapper()))
                .build()
                .create(ExampleClient.class);

        try {
            System.out.printf(exampleClient.timeoutLongerThan15seconds().get());
        } catch (InterruptedException | ExecutionException e) {
            throw new RuntimeException(e);
        }
    }

    public interface ExampleClient {
        @GET("/")
        CompletableFuture<String> timeoutLongerThan15seconds();
    }
}
[creqId=1610d1c0, preqId=d79df21f, chanId=3ba4813a, laddr=127.0.0.1:53821, raddr=localhost/127.0.0.1:18080][http://localhost:18080/#GET] 
Response: {startTime=2025-09-03T03:05:07.893Z(1756868707893717), length=0B, duration=0ns, 
totalDuration=15054ms(15054054333ns), cause=com.linecorp.armeria.client.ResponseTimeoutException, headers=[:status=0]}
  • As-Is: totalDuration=15054ms
  • To-Be : totalDuration=20000ms

If an user doesn’t explicitly call responseTimeoutForEachAttempt(), RetryConfig should respect whatever value is configured in responseTimeout, not to use Flags.defaultResponseTimeoutMillis() by default

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions