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

nacos中的MD5和服务收到的MD5不一致,导致日志不断打印 #2722

Closed
imcnchl opened this issue May 1, 2020 · 4 comments · Fixed by #2647
Closed

nacos中的MD5和服务收到的MD5不一致,导致日志不断打印 #2722

imcnchl opened this issue May 1, 2020 · 4 comments · Fixed by #2647

Comments

@imcnchl
Copy link

imcnchl commented May 1, 2020

Issue Description

Type: bug report

Describe what happened (or what feature you want)

nacos中的MD5和服务收到的MD5不一致,导致日志不断打印

Describe what you expected to happen

How to reproduce it (as minimally and precisely as possible)

  1. 在nacos中配置 gateway.yaml 配置
gateway:
  api:
    security:
      request:
        sign: false
      response:
        sign: true
  1. 发布之后,可以看到对应的服务中不断打印出日志:
    日志打印的MD5为:07e0cc99f8dde57e7f013d5d544d88a0
    image
    image

  2. 查看nacos中的配置的MD5:7e0cc99f8dde57e7f013d5d544d88a0
    image

  3. 对比两个MD5,发现nacos中的MD5比服务收到的MD5前面少了个0

  4. 尝试将配置文件中相关值修改为其他值,不会不断打印日志

@xiaobai14
Copy link

我也遇到这个问题了,nacos集群使用mysql做持久化配置,config_info表中的md5字段有时候只有31位,与服务中计算的md5比较,首位缺少个0;我连续修改几次dataId对应的配置文件,mysql中的md5又恢复正常了。请问下什么原因呢?

@chuntaojun chuntaojun linked a pull request May 6, 2020 that will close this issue
5 tasks
@imcnchl
Copy link
Author

imcnchl commented May 9, 2020

注意:使用以下方式获取到的MD5也会出现首位少0的情况

MessageDigest md = MessageDigest.getInstance("MD5");
String md5Text = new BigInteger(1, md.digest(text.getBytes())).toString(16);

@Visonwu
Copy link

Visonwu commented May 22, 2020

我也遇到了,debug找到原因了,nacos的服务端和客户端使用的不同md5方法对数据做摘要计算;

String str = "#nacos 连接地址\r\ndubbo.address=127.0.0.1:8848\r\ndubbo.protocol=nacos\r\ndubbo.timeout=30000"; 

String md5 = Md5Utils.getMD5(str, Constants.ENCODE); // 3b1346ccdbf9a218590699ce559bb08 服务端的md5计算

 String md5String = MD5.getInstance().getMD5String(str); // 03b1346ccdbf9a218590699ce559bb08 客户端的md5计算(CacheData类中);

@ordercard
Copy link

我也遇到这个问题了,一直没提 哈哈

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

Successfully merging a pull request may close this issue.

5 participants