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

Grpc HealthCheck Error #180

Closed
DevilMayFree opened this issue Jul 12, 2023 · 11 comments
Closed

Grpc HealthCheck Error #180

DevilMayFree opened this issue Jul 12, 2023 · 11 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@DevilMayFree
Copy link

nacos-sdk = { version = "0.3", features = ["default"] }

nacos server version: v2.2.3

Project startups sometimes display error logs:

2023-07-12T15:59:32.7610834+08:00 ERROR nacos_sdk::common::remote::grpc::nacos_grpc_connection: connection health check failed convert to grpc message failed. request_id:None ret_code:500 error_code:301 message:Some("Connection is unregistered.")
at C:\Users\Administrator.cargo\registry\src\rsproxy.cn-8f6827c7555bfaf8\nacos-sdk-0.3.0\src\common\remote\grpc\nacos_grpc_connection.rs:377
in nacos_sdk::common::remote::grpc::nacos_grpc_connection::grpc_connection with id: "naming:192.168.1.100:8848:rs_cloud:1"

or:

  2023-07-12T16:00:08.0258394+08:00 ERROR nacos_sdk::common::remote::grpc::message: payload {"resultCode":500,"errorCode":403,"message":"user not found!","success":false} can not convert to SubscribeServiceResponse occur an error:Serialization(Error("missing field `serviceInfo`", line: 1, column: 78))
at C:\Users\Administrator\.cargo\registry\src\rsproxy.cn-8f6827c7555bfaf8\nacos-sdk-0.3.0\src\common\remote\grpc\message\mod.rs:88
in nacos_sdk::common::remote::grpc::nacos_grpc_client::send_request
in nacos_sdk::naming::subscribe with client_id: "naming:192.168.1.100:8848:rs_cloud:1", group: "DEFAULT_GROUP"

how to fix? thanks

@onewe
Copy link
Collaborator

onewe commented Jul 13, 2023

开启了鉴权吗?

@onewe
Copy link
Collaborator

onewe commented Jul 13, 2023

从错误上看 应该是鉴权的问题

@CherishCai
Copy link
Collaborator

"errorCode":403,"message":"user not found!" 应该是服务端开启了鉴权,客户端没配对账号密码并开启 auth_login

@DevilMayFree
Copy link
Author

开启了鉴权吗?

有开启鉴权,账号密码正确

@DevilMayFree
Copy link
Author

"errorCode":403,"message":"user not found!" 应该是服务端开启了鉴权,客户端没配对账号密码并开启 auth_login

有开启鉴权,关闭后没报错,开启后账号密码正确,报错,有时是Connection is unregistered. 有时是"user not found!
但正常服务注册

code:

    let client_props = ClientProps::new()
        .server_addr(...)
        .namespace(...)
        .app_name(...)
        .auth_username("nacos")
        .auth_password("nacos");

    let naming_service = NamingServiceBuilder::new(client_props)
        .enable_auth_plugin_http()
        .build()
        .expect("Nacos naming_service build error");

@onewe
Copy link
Collaborator

onewe commented Jul 13, 2023

我这边复现一下

@CherishCai
Copy link
Collaborator

若服务端没开鉴权,那么客户端就不需要开

@CherishCai CherishCai added the question Further information is requested label Jul 13, 2023
@onewe onewe added the bug Something isn't working label Jul 20, 2023
@onewe onewe self-assigned this Jul 20, 2023
@CherishCai
Copy link
Collaborator

发现可能的问题。只要足够快,login 是异步的,可能在没得到 token 就去做 其它实际调用 了,那么就会呈现没有登陆的异常

image

@jinkaz
Copy link

jinkaz commented Jul 20, 2023

这个问题,我也碰到了。本机自己的服务测试没发现问题。放服务器上就必现。

@jinkaz
Copy link

jinkaz commented Jul 21, 2023

@CherishCai @onewe 两位大佬。我感觉就是蔡大哥说的登录异步引起的问题,获取配置我可以通过循环:
loop{
let result= rocket.state::()
.expect("获取配置信息失败")
.config_service.get_config(String::from(di.clone()), String::from(gn.clone()))
.await;

    match result {
        Ok(config_resp)=>{
            return config_resp;
        },
        Err(_)=>continue,
    }
};

来解决。
但是注册服务
ns.batch_register_instance(
sn,
Some(gn),
vec![service_instance],
).await.expect("nameservice batch register fail");
这个没法通过循环绕过去。
等待两位大哥能解决这个bug,我打算在公司生产上通过一些边缘化服务进行rust改造了,就等两位大哥的好消息了

@CherishCai
Copy link
Collaborator

@CherishCai @onewe 两位大佬。我感觉就是蔡大哥说的登录异步引起的问题,获取配置我可以通过循环: loop{ let result= rocket.state::() .expect("获取配置信息失败") .config_service.get_config(String::from(di.clone()), String::from(gn.clone())) .await;

    match result {
        Ok(config_resp)=>{
            return config_resp;
        },
        Err(_)=>continue,
    }
};

来解决。 但是注册服务 ns.batch_register_instance( sn, Some(gn), vec![service_instance], ).await.expect("nameservice batch register fail"); 这个没法通过循环绕过去。 等待两位大哥能解决这个bug,我打算在公司生产上通过一些边缘化服务进行rust改造了,就等两位大哥的好消息了

近期就会解决。另外 loop 还不如启动时候初始化 client 后 sleep 500ms 更简单,哈哈哈

onewe added a commit to onewe/nacos-sdk-rust that referenced this issue Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants