#spring-cloud-gateway
#spring-cloud-gateway
Вопрос:
На моем шлюзе Retry GatewayFilter
настроено выполнение повторных попыток при 5xx последовательных ошибках, однако шлюз выполняет повторные попытки, хотя служба, стоящая за ним, возвращает 200 OK.
- name: Retry
args:
retries: 3
series: SERVER_ERROR
methods: GET,POST
backoff:
firstBackoff: 10ms
maxBackoff: 500ms
factor: 2
basedOnPreviousValue: false
Ниже сообщения об ошибке на шлюзе
...
DEBUG o.s.w.r.f.client.ExchangeFunctions - [1847f1ae] HTTP GET http://localhost:9000/resource
DEBUG o.s.w.r.f.client.ExchangeFunctions - [1847f1ae] Response 200 OK
DEBUG o.s.w.r.f.client.ExchangeFunctions - [1847f1ae] Cancel signal (to close connection)
DEBUG org.springframework.web.HttpLogging - [5451ae41-1] Resolved [IllegalStateException: The client response body has been released already due to cancellation.] for HTTP GET /service/resource
ERROR o.s.b.a.w.r.e.AbstractErrorWebExceptionHandler - [5451ae41-1] 500 Server Error for HTTP GET "/service/resource"
java.lang.IllegalStateException: The client response body has been released already due to cancellation.
...
DEBUG org.springframework.web.HttpLogging - [5451ae41-1] Encoding [{timestamp=Fri Aug 21 11:49:34 ART 2020, path=/service/resource, status=500, error=Internal Server E (truncated)...]
ERROR reactor.core.publisher.Operators - Operator called default onErrorDropped java.lang.IllegalStateException: Only one connection receive subscriber allowed.
...
ERROR reactor.core.publisher.Operators - Operator called default onErrorDropped
java.lang.IllegalStateException: The client response body has been released already due to cancellation.
at org.springframework.http.client.reactive.ReactorClientHttpResponse.lambda$getBody$0(ReactorClientHttpResponse.java:98)
...
DEBUG o.s.w.s.a.HttpWebHandlerAdapter - [5451ae41-1] Completed 500 INTERNAL_SERVER_ERROR
Я ожидал, что шлюз вернет 200 OK с ответом, доставленным службой (у меня не настроен другой фильтр ответов)
Сегодня я использую Hoxton.Выпуск SR6 Spring Cloud с 2.3.2.RELEASE Spring.
ВАЖНО: Этой проблемы не было в моей предыдущей конфигурации (Hoxton.Выпуск SR4 Spring Cloud с 2.3.0.RELEASE Spring)