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

[Bug]:Can not aquire the specific config #11967

Closed
robocanic opened this issue Apr 16, 2024 · 9 comments
Closed

[Bug]:Can not aquire the specific config #11967

robocanic opened this issue Apr 16, 2024 · 9 comments
Labels
area/Config kind/bug Category issues or prs related to bug.

Comments

@robocanic
Copy link

Describe the bug

environments:

  • java version: corretto 21
  • nacos sdk/client version: 2.3.2
  • nacos deployment mode: standalone, windows10 PC

I start a dubbo service on local PC(the code of this dubbo service comes from the dubbo-samples), using nacos client 2.2.0. And it works fine, the service registered and I can find the config and service info through the console:
image
image

Following the "quick start" of the official website , I want to get the config content of "dataId=org.apache.dubbo.samples.UserService:::provider:shop-user, group=dubbo" as below:

public class NacosApplication {
    public static void main(String[] args) {
        String content;
        try {
            String serverAddr = "localhost:8848";
            String dataId = "org.apache.dubbo.samples.UserService:::provider:shop-user";
            String group = "dubbo";
            Properties properties = new Properties();
            properties.put("serverAddr", serverAddr);
            ConfigService configService = NacosFactory.createConfigService(properties);
            content = configService.getConfig(dataId, group, 5000);
            System.out.println("content is:"+content);
        } catch (NacosException e) {
            e.printStackTrace();
        }
    }
}

The expected result config content should be :
image
But it returns null:
image

Then I change the dataId and group to try to aquire another config content:

public class NacosApplication {
    public static void main(String[] args) {
        String content;
        try {
            String serverAddr = "localhost:8848";
            String dataId = "org.apache.dubbo.samples.UserService";
            String group = "mapping";
            Properties properties = new Properties();
            properties.put("serverAddr", serverAddr);
            ConfigService configService = NacosFactory.createConfigService(properties);
            content = configService.getConfig(dataId, group, 5000);
            System.out.println("content is:"+content);
        } catch (NacosException e) {
            e.printStackTrace();
        }
    }
}

It works fine just as below, which is really wired:
image
image

I have confirmed that the dataId and group is the same as the console shows, I have no idea for this bug, can someone tell me where the problem lies?

@985492783
Copy link
Contributor

你好,麻烦将不可用的配置内容,dataId和group发一下,我复现下看看

@robocanic
Copy link
Author

你好,麻烦将不可用的配置内容,dataId和group发一下,我复现下看看

dataId: org.apache.dubbo.samples.UserService:::provider:shop-user
group: dubbo
content: {"annotations":[],"canonicalName":"org.apache.dubbo.samples.UserService","codeSource":"file:/D:/code/dubbo-samples/10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/target/classes/","methods":[{"annotations":[],"name":"register","parameterTypes":["org.apache.dubbo.samples.User"],"parameters":[],"returnType":"boolean"},{"annotations":[],"name":"getInfo","parameterTypes":["java.lang.String"],"parameters":[],"returnType":"org.apache.dubbo.samples.User"},{"annotations":[],"name":"login","parameterTypes":["java.lang.String","java.lang.String"],"parameters":[],"returnType":"org.apache.dubbo.samples.User"},{"annotations":[],"name":"timeoutLogin","parameterTypes":["java.lang.String","java.lang.String"],"parameters":[],"returnType":"org.apache.dubbo.samples.User"}],"parameters":{"anyhost":"true","pid":"20560","interface":"org.apache.dubbo.samples.UserService","side":"provider","dubbo":"2.0.2","application":"shop-user","release":"3.2.7","executor-management-mode":"isolation","file-cache":"true","methods":"getInfo,login,register,timeoutLogin","deprecated":"false","qos.port":"20994","service-name-mapping":"true","timeout":"1000","generic":"false","bind.port":"20884","token":"d9f0fc3f-2fc6-4684-9405-e8c2311df916","qos.anonymous.access.permission.level":"PROTECTED","bind.ip":"2.0.0.1","prefer.serialization":"fastjson2,hessian2","background":"false","dynamic":"true","qos.anonymous.access.allow.commands":"metrics","timestamp":"1713234842852"},"types":[{"enums":[],"items":[],"properties":{},"type":"boolean"},{"enums":[],"items":[],"properties":{"realName":"java.lang.String","password":"java.lang.String","mail":"java.lang.String","phone":"java.lang.String","env":"java.lang.String","username":"java.lang.String"},"type":"org.apache.dubbo.samples.User"},{"enums":[],"items":[],"properties":{},"type":"java.lang.String"}],"uniqueId":"org.apache.dubbo.samples.UserService@file:/D:/code/dubbo-samples/10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/target/classes/"}

@985492783
Copy link
Contributor

985492783 commented Apr 16, 2024

我用jdk8和jdk21都没有复现出来,客户端debug看下请求
服务端看下config-pull-check.log,或者配置nacos.plugin.datasource.log.enabled=true看下sql对不对

@robocanic
Copy link
Author

debug:
image-20240416172752667

config-dump.log

image-20240416173742502

config-pull-check.log

image-20240416173834122

看起来是server端有些问题

@985492783
Copy link
Contributor

看样子是client获取到数据后保存快照的时候报错了,文件名特殊符号不支持

@KomachiSion
Copy link
Collaborator

新版本应该在写缓存的时候有进行encode的,是否是系统版本读取的时候没读取正确?

可以看下 PathEncode 和PathEncodeManager是否没有用上或者读取错误导致没有识别到用Windows的PathEncode

@KomachiSion
Copy link
Collaborator

#10101

@KomachiSion
Copy link
Collaborator

com.alibaba.nacos.config.server.service.dump.disk.ConfigRawDiskService

DiskUtil被迁移到了这个上面,但是丢失了#10101中的encode修复

@KomachiSion KomachiSion added kind/bug Category issues or prs related to bug. area/Config labels Apr 17, 2024
@robocanic
Copy link
Author

这个问题在哪些版本中存在?

syshenyao added a commit to syshenyao/nacos that referenced this issue Apr 22, 2024
syshenyao added a commit to syshenyao/nacos that referenced this issue Apr 23, 2024
syshenyao added a commit to syshenyao/nacos that referenced this issue Apr 25, 2024
syshenyao pushed a commit to syshenyao/nacos that referenced this issue Apr 29, 2024
syshenyao added a commit to syshenyao/nacos that referenced this issue Apr 29, 2024
syshenyao added a commit to syshenyao/nacos that referenced this issue May 6, 2024
syshenyao added a commit to syshenyao/nacos that referenced this issue May 6, 2024
syshenyao added a commit to syshenyao/nacos that referenced this issue May 11, 2024
KomachiSion pushed a commit that referenced this issue May 15, 2024
* [ISSUE #11967] Can not aquire the specific config

* [ISSUE #11967] Can not aquire the specific config

* [ISSUE #11967] Can not aquire the specific config

* [ISSUE #11967] Can not aquire the specific config

* [ISSUE #11967] Can not aquire the specific config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/Config kind/bug Category issues or prs related to bug.
Projects
None yet
Development

No branches or pull requests

3 participants