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

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

Closed
benfromchina opened this issue May 15, 2024 · 8 comments
Closed
Labels
kind/question Category issues related to questions or problems

Comments

@benfromchina
Copy link

benfromchina commented May 15, 2024

版本: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
Copy link
Collaborator

-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 KomachiSion added the kind/question Category issues related to questions or problems label May 24, 2024
@benfromchina
Copy link
Author

benfromchina commented May 24, 2024

-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
Copy link
Author

-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

@besthanliu
Copy link

besthanliu commented Aug 6, 2024

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

@hxc001
Copy link

hxc001 commented Oct 15, 2024

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

@hxc001
Copy link

hxc001 commented Oct 15, 2024

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

@XiaZhouxx
Copy link
Contributor

对应的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版本社区很久没更新了 活跃度都不怎么高

@hxc001
Copy link

hxc001 commented Oct 16, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Category issues related to questions or problems
Projects
None yet
Development

No branches or pull requests

5 participants