spring-cloud / spring-cloud/spring-cloud-gateway

response timeout configuration through refresh via config-server

Open
#2,138 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Java
Stars
4.9k
Forks
3.5k
Avg merge
20h 57m
Merged PRs (30d)
8

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the configuration change through the /actuator/refresh endpoint using Spring Cloud Config, comparing a configured responseTimeout with a removed or NULL value. Confirm that refresh clears the previously applied timeout just as a gateway restart does; the existing request examples provide the expected behavior and timings.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.