spring-cloud / spring-cloud/spring-cloud-consul

ConfigWatch scheduled refresh throws errors after initial Consul config load

Open
#951 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
822
Forks
539
Avg merge
9h 31m
Merged PRs (30d)
7

Description

Describe the bug
Spring Cloud Consul Сonfig 5.0.0

When starting a project, the initial initialization of properties with consul occurs correctly.

But each subsequent scheduled call to the ConfigWatch::watchConfigKeyValues ​​method generates an error

2026-01-27T16:04:49.322+02:00 WARN 21920 --- [gateway] [ctor-http-nio-4] r.netty.http.client.HttpClientConnect : [0fd22999-1, L:/127.0.0.1:49984 - R:localhost/127.0.0.1:8500] The connection observed an error

io.netty.handler.timeout.ReadTimeoutException

2026-01-27T16:04:49.325+02:00 ERROR 21920 --- [gateway] [TaskScheduler-1] o.s.cloud.consul.config.ConfigWatch : Fail fast is set and there was an error reading configuration from consul.
2026-01-27T16:04:49.325+02:00 ERROR 21920 --- [gateway] [TaskScheduler-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task

org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8500/v1/kv/config/gateway,default/": null

I want to say once again that the initial initialization via spring.config.import: 'consul:' was successful. Also, if you disable watch config, there are no errors. All of the above suggests that the problem is not in Consul, but in the functionality of the ConfigWatch::watchConfigKeyValues ​​method.

I tested the project with both WebMVC and WebFlux. I found that errors occur only when using WebFlux.
When using WebMVC, everything works correctly.

Sample
Create Spring Boot project with webflux and spring-cloud-starter-consul-config starter.

Your project will start on port 8082 since the initial initialization was successful. But later on, errors will start to be generated due to ConfigWatch::watchConfigKeyValues.

application.yaml

spring:
  application:
    name: gateway
  config:
    import: 'consul:'
  cloud:
    consul:
      host: localhost
      port: 8500

Consul KV

Key: config/gateway,default/server.port
Value: 8082

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

Start at ConfigWatch.watchConfigKeyValues and reproduce the issue with the WebFlux sample, Consul KV entry, and application.yaml described here. Compare scheduled refresh behavior with WebMVC while checking the reported ReadTimeoutException and ResourceAccessException. Done means scheduled refresh works without errors under WebFlux while the initial Consul import continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.