spring-cloud/spring-cloud-gateway

response timeout configuration through refresh via config-server

Open

#2.138 aberto em 3 de fev. de 2021

Ver no GitHub
 (2 comments) (0 reactions) (0 assignees)Java (3.204 forks)batch import
enhancementhelp wanted

Métricas do repositório

Stars
 (4.284 stars)
Métricas de merge de PR
 (Mesclagem média 1d 21h) (18 fundiu PRs em 30d)

Description

I want to disable the response-timeout entirely in gateway, which is possible by configuring spring.cloud.gateway.responseTimeout with NULL.

spring:
  cloud:
    gateway:
      httpclient:
        connectTimeout: 1000
        # defaults to NULL or explicit with responseTimeout: ~

I tested the YAML values 0, -1 and ~ (NULL) as responseTimeout and also removing the whole field to disable the timeout and then started the gateway:

  • 0 and -1 led to all proxy requests timeout immediatly
  • ~ and removing the field actually disables the responseTimeout

Now this is fine, it should maybe be mentioned in the documentation, maybe it's obvious ¯\_(ツ)_/¯

BUT

If you use configuration via spring cloud config and the /actuator/refresh endpoint to apply a new config it is impossible to disbale the responseTimeout.

Even worse, if you change the config in the config-server remote source to ~ or if you remove the field, the readTimeout silently stays at the previously configured value:

initial config on boot:

spring:
  cloud:
    gateway:
      httpclient:
        connectTimeout: 1000
        responseTimeout: 11000

=> downstream requests time out after 11 seconds

decrease responseTimout:

spring:
  cloud:
    gateway:
      httpclient:
        connectTimeout: 1000
        responseTimeout: 5000
curl -XPOST http://localhost:8943/actuator/refresh
# ["spring.cloud.gateway.httpclient.responseTimeout"]

=> downstream requests time out after 5 seconds

disable responseTimout:

spring:
  cloud:
    gateway:
      httpclient:
        connectTimeout: 1000
        responseTimeout: ~

or

spring:
  cloud:
    gateway:
      httpclient:
        connectTimeout: 1000
curl -XPOST http://localhost:8943/actuator/refresh
# ["spring.cloud.gateway.httpclient.responseTimeout"]

=> downstream requests time out after 5 seconds

So it looks like there is a different behaviour of the global gateway config when you reboot the revice or refresh it via config-client.

Guia do colaborador