alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
29.48k stars 12.67k forks source link

ClientWorker 超时时间没有读取配置,而是写死 3000 毫秒 #12103

Open benfromchina opened 1 month ago

benfromchina commented 1 month ago

版本:spring-cloud-starter-alibaba-nacos-config-2023.0.1.0.jar

截屏2024-05-15 18 18 26 截屏2024-05-15 18 20 36

客户端会间歇性的异常

2024-05-15 17:55:05.801 ERROR 1 --- [listener.task-0] c.a.n.client.config.impl.ClientWorker    : Execute listen config change error 
com.alibaba.nacos.api.exception.NacosException: java.util.concurrent.TimeoutException: Waited 3000 milliseconds (plus 130570 nanoseconds delay) for com.alibaba.nacos.shaded.io.grpc.stub.ClientCalls$GrpcFuture@4719fd3d[status=PENDING, info=[GrpcFuture{clientCall=ClientCallImpl{method=MethodDescriptor{fullMethodName=Request/request, type=UNARY, idempotent=false, safe=false, sampledToLocalTracing=true, requestMarshaller=com.alibaba.nacos.shaded.io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller@79bd045c, responseMarshaller=com.alibaba.nacos.shaded.io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller@564e10ac, schemaDescriptor=com.alibaba.nacos.api.grpc.auto.RequestGrpc$RequestMethodDescriptorSupplier@38320784}}}]]
        at com.alibaba.nacos.common.remote.client.grpc.GrpcConnection.request(GrpcConnection.java:82)
        at com.alibaba.nacos.common.remote.client.RpcClient.request(RpcClient.java:646)
        at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.requestProxy(ClientWorker.java:1221)
        at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.requestProxy(ClientWorker.java:1202)
        at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.lambda$checkListenCache$7(ClientWorker.java:1018)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.util.concurrent.TimeoutException: Waited 3000 milliseconds (plus 130570 nanoseconds delay) for com.alibaba.nacos.shaded.io.grpc.stub.ClientCalls$GrpcFuture@4719fd3d[status=PENDING, info=[GrpcFuture{clientCall=ClientCallImpl{method=MethodDescriptor{fullMethodName=Request/request, type=UNARY, idempotent=false, safe=false, sampledToLocalTracing=true, requestMarshaller=com.alibaba.nacos.shaded.io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller@79bd045c, responseMarshaller=com.alibaba.nacos.shaded.io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller@564e10ac, schemaDescriptor=com.alibaba.nacos.api.grpc.auto.RequestGrpc$RequestMethodDescriptorSupplier@38320784}}}]]
        at com.alibaba.nacos.shaded.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:531)
        at com.alibaba.nacos.common.remote.client.grpc.GrpcConnection.request(GrpcConnection.java:79)
        ... 9 common frames omitted

是否可以改为读取配置参数 spring.cloud.nacos.config.timeout

KomachiSion commented 1 month ago

-Dnacos.remote.client.grpc.timeout=${请求超时,单位毫秒,默认3000}

检测所连接的服务端是否健康,不健康则触发重连

-Dnacos.remote.client.grpc.server.check.timeout=${服务端健康检测,单位毫秒,默认3000}

检测当前连接状态是否健康,不健康则触发重连

-Dnacos.remote.client.grpc.health.timeout=${连接健康检测,单位毫秒,默认3000}

2.1.2 版本以上

benfromchina commented 1 month ago

-Dnacos.remote.client.grpc.timeout=${请求超时,单位毫秒,默认3000}

检测所连接的服务端是否健康,不健康则触发重连

-Dnacos.remote.client.grpc.server.check.timeout=${服务端健康检测,单位毫秒,默认3000}

检测当前连接状态是否健康,不健康则触发重连

-Dnacos.remote.client.grpc.health.timeout=${连接健康检测,单位毫秒,默认3000}

2.1.2 版本以上

是放在客户端侧,配置有效果,感谢。

benfromchina commented 1 month ago

-Dnacos.remote.client.grpc.timeout=${请求超时,单位毫秒,默认3000}

检测所连接的服务端是否健康,不健康则触发重连

-Dnacos.remote.client.grpc.server.check.timeout=${服务端健康检测,单位毫秒,默认3000}

检测当前连接状态是否健康,不健康则触发重连

-Dnacos.remote.client.grpc.health.timeout=${连接健康检测,单位毫秒,默认3000}

2.1.2 版本以上

这三个参数并不能解决代码写死 3000 毫秒的问题

截屏2024-05-29 08 32 34 截屏2024-05-29 08 33 24