Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

ConfigWatch scheduled refresh throws errors after initial Consul config load

未关闭
#951 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
领域
backend, cloud

调研方向

从 ConfigWatch.watchConfigKeyValues 开始,使用此处描述的 WebFlux 示例、Consul KV 条目和 application.yaml 重现该问题。比较计划刷新与 WebMVC 的行为,同时检查报告的 ReadTimeoutException 和 ResourceAccessException。当 WebFlux 下的计划刷新能够无错误地工作,且初始 Consul 导入仍能正常工作时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

waiting-for-triage

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
主要语言
Java
星标
821
派生
540
平均合并
12 小时 56 分钟
30 天内合并 PR
15

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

spring-cloud/spring-cloud-consul 的其他 Issue

查看 spring-cloud/spring-cloud-consul 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。