Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用RefreshScope 注解,项目在运行一段时间后失效 #3667

Closed
NetRainn opened this issue Mar 28, 2024 · 5 comments
Closed

使用RefreshScope 注解,项目在运行一段时间后失效 #3667

NetRainn opened this issue Mar 28, 2024 · 5 comments

Comments

@NetRainn
Copy link

问题描述

使用RefreshScope 注解,项目在运行一段时间后失效。
项目中使用该注解,正常情况下是可以读取到nacos上的配置变化,但是运行一段时间后就始终读取不到修改后的配置,属于偶发

排查

已排查:nacos上可以看到服务是正常运行的,没有掉,接口也是可以正常请求。服务器上本地记录也没有更新
日志没有探测到配置有变化,请问是什么情况?

未正常拉取到修改后的日志

2024-03-26 03:46:28.772  INFO 3891222 --- [cos.product-103612] [                                ] c.a.n.client.config.impl.ClientWorker    : [47291759-6e10-4748-be68-ef2a98e1f231_config-0] [server-push] config changed. dataId=java-product-trade-service-test.properties, group=DEFAULT_GROUP,tenant=test
2024-03-26 03:46:28.772  INFO 3891222 --- [cos.product-103612] [                                ] com.alibaba.nacos.common.remote.client   : [47291759-6e10-4748-be68-ef2a98e1f231_config-0] Ack server push request, request = ConfigChangeNotifyRequest, requestId = 9659

拉取到修改后的配置

2024-03-26 05:40:23.119  INFO 1561460 --- [nacos.product-1510] [                                ] c.a.n.client.config.impl.ClientWorker    : [4cfe57e9-bf24-4f70-9605-8f605e975549_config-0] [server-push] config changed. dataId=java-product-trade-service-test.properties, group=DEFAULT_GROUP,tenant=test
2024-03-26 05:40:23.119  INFO 1561460 --- [nacos.product-1510] [                                ] com.alibaba.nacos.common.remote.client   : [4cfe57e9-bf24-4f70-9605-8f605e975549_config-0] Ack server push request, request = ConfigChangeNotifyRequest, requestId = 9681

2024-03-26 05:40:23.127  INFO 1561460 --- [s.client.Worker] [                                ] c.a.n.client.config.impl.ClientWorker    : [fixed-test-server.config.nacos.product_8848] [data-received] dataId=java-product-trade-service-test.properties, group=DEFAULT_GROUP, tenant=test, md5=df735c9a5027c8ad4e18d7e89a9636bd, content=spring.cloud.nacos.discovery.server-addr=server.discovery.nacos.product:8848
spring.cloud.nacos.discove..., type=properties
2024-03-26 05:40:23.127  INFO 1561460 --- [s.client.Worker] [                                ] c.a.nacos.client.config.impl.CacheData   : [fixed-test-server.config.nacos.product_8848] [notify-listener] time cost=0ms in ClientWorker, dataId=java-product-trade-service-test.properties, group=DEFAULT_GROUP, md5=df735c9a5027c8ad4e18d7e89a9636bd, listener=com.alibaba.cloud.nacos.refresh.NacosContextRefresher$1@79c9c648 
2024-03-26 05:40:23.127  INFO 1561460 --- [ternal.notifier] [                                ] c.a.nacos.client.config.impl.CacheData   : [fixed-test-server.config.nacos.product_8848] [notify-context] dataId=java-product-trade-service-test.properties, group=DEFAULT_GROUP, md5=df735c9a5027c8ad4e18d7e89a9636bd
2024-03-26 05:40:23.529  WARN 1561460 --- [ternal.notifier] [                                ] c.a.nacos.client.logging.NacosLogging    : Load Logback Configuration of Nacos fail, message: Could not initialize Logback Nacos logging from classpath:nacos-logback.xml
2024-03-26 05:40:23.534  WARN 1561460 --- [ternal.notifier] [                                ] c.a.nacos.client.logging.NacosLogging    : Load Logback Configuration of Nacos fail, message: Could not initialize Logback Nacos logging from classpath:nacos-logback.xml
2024-03-26 05:40:23.571  WARN 1561460 --- [ternal.notifier] [                                ] c.a.nacos.client.logging.NacosLogging    : Load Logback Configuration of Nacos fail, message: Could not initialize Logback Nacos logging from classpath:nacos-logback.xml
2024-03-26 05:40:23.579  WARN 1561460 --- [ternal.notifier] [                                ] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[java-product-trade-service] & group[DEFAULT_GROUP]
2024-03-26 05:40:23.581  WARN 1561460 --- [ternal.notifier] [                                ] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[java-product-trade-service.properties] & group[DEFAULT_GROUP]
2024-03-26 05:40:23.585  INFO 1561460 --- [ternal.notifier] [                                ] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-java-product-trade-service-test.properties,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-java-product-trade-service.properties,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-java-product-trade-service,DEFAULT_GROUP'}]
2024-03-26 05:40:23.598  WARN 1561460 --- [ternal.notifier] [                                ] c.a.nacos.client.logging.NacosLogging    : Load Logback Configuration of Nacos fail, message: Could not initialize Logback Nacos logging from classpath:nacos-logback.xml
2024-03-26 05:40:23.599  INFO 1561460 --- [ternal.notifier] [                                ] o.s.boot.SpringApplication               : The following 1 profile is active: "test"
2024-03-26 05:40:23.612  INFO 1561460 --- [ternal.notifier] [                                ] o.s.boot.SpringApplication               : Started application in 0.482 seconds (process running for 6310.022)
2024-03-26 05:40:23.659  INFO 1561460 --- [ternal.notifier] [                                ] o.s.c.e.event.RefreshEventListener       : Refresh keys changed: [trade.pay.max.amount]
2024-03-26 05:40:23.659  INFO 1561460 --- [ternal.notifier] [                                ] c.a.nacos.client.config.impl.CacheData   : [fixed-test-server.config.nacos.product_8848] [notify-ok] dataId=java-product-trade-service-test.properties, group=DEFAULT_GROUP, md5=df735c9a5027c8ad4e18d7e89a9636bd, listener=com.alibaba.cloud.nacos.refresh.NacosContextRefresher$1@79c9c648 ,cost=532 millis. 

环境说明

系统:Ubuntu 22
Nacos版本:2.2.3
nacos-client:2.2.1
SpringBoot版本:3.0.2

@ruansheng8
Copy link
Collaborator

需要先确认2个问题:

  1. Spring Cloud Alibaba 具体的版本号
  2. Nacos 是单机模式还是集群模式

以及可以添加一下 Nacos 调试日志,看下服务端收到的配置是否是最新的

logging:
  level:
    # 打印 Nacos 远程配置信息
    com.alibaba.cloud.nacos.configdata.NacosConfigDataLoader: debug

@NetRainn
Copy link
Author

  1. Spring Cloud Alibaba 版本号2022.0.0.0
  2. 单机版

@yuluo-yx
Copy link
Collaborator

yuluo-yx commented Mar 28, 2024

@NetRainn 社区有相关的 issue 问题,可以先试试里面的解决方案看看
https://github.com/alibaba/spring-cloud-alibaba/issues?q=is%3Aissue+RefreshScope

@yuluo-yx yuluo-yx added kind/question area/nacos spring cloud alibaba nacos labels Mar 28, 2024
Copy link

This issue has been open 30 days with no activity. This will be closed in 7 days.

@github-actions github-actions bot added the stale label Apr 27, 2024
Copy link

github-actions bot commented May 5, 2024

This issue has been automatically marked as stale because it hasn't had any recent activity.If you think this should still be open, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up. Thank you for your interest and contribution to the Sping Cloud Alibaba Community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants