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

没有修改配置,但是客户端会一直打印 changed 日志 #325

Open
Jarvan-Chan opened this issue Sep 26, 2024 · 10 comments
Open

Comments

@Jarvan-Chan
Copy link

29edf10b0ec80a5a95f6efed14a804d2
我的服务启动后,会一直打印 changed ,但是我没有更新过这个配置文件,然后即使我通过 nacos web,重新编辑发布了这个配置,这个 changed 日志仍然会一直打印。磁盘空间基本都被打满了。是什么原因呢?

@Jarvan-Chan
Copy link
Author

而且每条 changed 日志的 md5 值都是一样的。

@Jarvan-Chan
Copy link
Author

客户端:
nacos-sdk-csharp.AspNetCore 1.3.8
nacos-sdk-csharp.Extensions.Configuration 1.3.8
服务端:
nacos/nacos-server 2.0.3

@Jarvan-Chan
Copy link
Author

image
我理解,应该是服务端一直给客户端推送配置变化的通知,这两个服务内存占用率很高。我停掉客户端,服务器的内存占用率就降到基本为0%了。

@catcherwong
Copy link
Collaborator

贴一下 client 那边 nacos 相关的配置,我看前面的日志,用的还是长轮询。

@Jarvan-Chan
Copy link
Author

{
  "NacosConfig": {
    "Listeners": [
      {
        "Optional": false,
        "DataId": "qilun-auth-dev.json",
        "Group": "DEFAULT_GROUP"
      }
    ],
    "ServerAddresses": [
      // "http://192.168.0.144:8848/",
      // "http://192.168.244.130:8848/"
      "http://nacos:8848/"
    ],
    "Namespace": "public",
    "ServiceName": "qilun-auth-service",
    "DefaultTimeOut": 15000,
    "ListenInterval": 60000,
    "RegisterEnabled": true,
    "InstanceEnabled": true,
    "Ephemeral": true,
    "Secure": false,
    "ConfigUseRpc": false,
    "NamingUseRpc": false
  }
}

@Jarvan-Chan
Copy link
Author

服务端的 json 配置 qilun-auth-dev.json

{
	"Logging": {
		"LogLevel": {
			"Default": "Information",
			"Microsoft.AspNetCore": "Warning"
		}
	},
	"AllowedHosts": "*",
	"NacosConfig": {
		"Listeners": [{
			"Optional": false,
			"DataId": "qilun-auth-dev.json",
			"Group": "DEFAULT_GROUP"
		}],
		"ServerAddresses": ["http://192.168.244.130:8848/"],
		"DefaultTimeOut": 15000,
		"Namespace": "public",
		"ListenInterval": 60000,
		"ServiceName": "qilun-auth-service",
		"GroupName": "DEFAULT_GROUP",
		"UserName": "nacos",
		"Password": "nacos"
	},
	"MySQL": {
		"ConnectionStrings": {
			"Default": "server=192.168.244.130;port=3306;Database=qilun-auth;Uid=root;Pwd=123456;",
			"Test": "server=mysql8028;port=3306;Database=qilun-auth;Uid=root;Pwd=123456;",
			"Dev": "server=192.168.244.130;port=3306;Database=qilun-auth;Uid=root;Pwd=123456;"
		},
		"MarkDeletionColumnName": "deleted"
	},
	"Redis": {
		"ConnectionStrings": {
			"Default": "192.168.244.130:6379,password=123456,defaultDatabase=0"
		},
		"SetValueTimeOutSeconds": 3600
	},
	"IoC":{
		"BLL": "QiLun.Auth.BLL"
	},
	"Auth": {
		"VerifyCodeExpireMinutes": 5,
		"TokenExpireMinutes": 180
	},
	"Login": {
		"MaxFailureRetryCount": 5,
		"MaxFailureRetryCountExpireMinutes": 60
	},
	"Register": {
		"MaxFailureRetryCount": 5,
		"MaxFailureRetryCountExpireMinutes": 60
	}
}

不会是因为我服务端也配置了 NacosConfig 节点,起了冲突吧?

@Jarvan-Chan
Copy link
Author

Jarvan-Chan commented Sep 26, 2024

我不懂是不是bug,我客户端打包的时候,appsettings.json 添加了 "ClusterName": "DEFAULT", "GroupName": "DEFAULT_GROUP", ,重新发布之后,内存占用率变回0.x%了,然后我再去掉那两条配置,重新打包发布之后,也没有复现疯狂通知 changed 的现象了。这个现象不是必现,但是我遇到好几次了。不懂是什么原因恢复的。

@Jarvan-Chan
Copy link
Author

这个问题还是会出现,不明白是什么原因导致一直认为 config 有变化,但是根本就没有改配置,客户端仍然会死循环一样接收到配置变化的通知。

@Jarvan-Chan
Copy link
Author

我把nacos server 升级到2.4.2,似乎又好了。再观察观察后续还会不会出行这个问题。

@Jarvan-Chan
Copy link
Author

现在已经基本确认了,重新部署运行业务服务,是不会出现这个问题的,但是如果是重启业务服务的话,nacos/server 这个问题是必现的,会无限循环告诉 client 配置有变化,但是实际是没有任何变化的。

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

No branches or pull requests

2 participants