line / armeria

Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
https://armeria.dev
Apache License 2.0
4.8k stars 912 forks source link

`RetryingClient` gets deadlocked when a decorator returns a failed response. #5708

Open ikhoon opened 4 months ago

ikhoon commented 4 months ago

If a decorator inside RetryingClient directly returns a failed response, it may not complete RequestLog. A RetryingClient that waits for the log to be completed will be hanged. https://github.com/line/armeria/blob/01f2c6f6ee49548c499b202be50fc9d3df84dd4f/core/src/main/java/com/linecorp/armeria/client/retry/RetryingClient.java#L375-L379

I encountered the problem when OauthClient received an invalid response that completes .getAccessToken() exceptionally. https://github.com/line/armeria/blob/01f2c6f6ee49548c499b202be50fc9d3df84dd4f/oauth2/src/main/java/com/linecorp/armeria/client/auth/oauth2/OAuth2Client.java#L63-L69

Related: https://github.com/line/armeria/pull/4834

We need to think more about how to solve this, but the approach should be to remove access to RequestLog from RetryingClient.