nacos icon indicating copy to clipboard operation
nacos copied to clipboard

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

Open benfromchina opened this issue 1 year ago • 4 comments

版本: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

benfromchina avatar May 15 '24 10:05 benfromchina

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

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

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

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

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

2.1.2 版本以上

KomachiSion avatar May 24 '24 02:05 KomachiSion

-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 avatar May 24 '24 02:05 benfromchina

-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

benfromchina avatar May 29 '24 00:05 benfromchina

@KomachiSion 请问这个配置可以通过nacos配置来定义吗? image

besthanliu avatar Aug 06 '24 09:08 besthanliu

对应的spring-boot版本没有更新呢? 依赖包nacos-config-spring-boot-autoconfigure 另外,nacos-config-spring-boot-starter目前最新0.3.0-RC版本,何时发布最新版本? 最后,使用nacos客户端 spring-boot项目java -jar启动时使用时需要避免使用ForkJoinPool线程池,因为其内部使用的系统(应用)类加载器,会导致无法加载相关类

xiaomaguohe001 avatar Oct 15 '24 09:10 xiaomaguohe001

2.4.3版本中com.alibaba.nacos.api.annotation.NacosProperties注解类里缺失变量定义 configRequestTimeout

xiaomaguohe001 avatar Oct 15 '24 09:10 xiaomaguohe001

对应的spring-boot版本没有更新呢? 依赖包nacos-config-spring-boot-autoconfigure 另外,nacos-config-spring-boot-starter目前最新0.3.0-RC版本,何时发布最新版本? 最后,使用nacos客户端 spring-boot项目java -jar启动时使用时需要避免使用ForkJoinPool线程池,因为其内部使用的系统(应用)类加载器,会导致无法加载相关类

可以考虑下替换为spring-cloud-alibaba, 看spring-boot版本社区很久没更新了 活跃度都不怎么高

XiaZhouxx avatar Oct 16 '24 02:10 XiaZhouxx

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

xiaomaguohe001 avatar Oct 16 '24 02:10 xiaomaguohe001