spring-cloud/spring-cloud-gateway

response timeout configuration through refresh via config-server

Open

#2 138 ouverte le 3 févr. 2021

Voir sur GitHub
 (2 commentaires) (0 réactions) (0 assignés)Java (3 204 forks)batch import
enhancementhelp wanted

Métriques du dépôt

Stars
 (4 284 stars)
Métriques de merge PR
 (Merge moyen 1j 21h) (18 PRs mergées en 30 j)

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.

Guide contributeur