grpc-ecosystem / grpc-spring

Spring Boot starter module for gRPC framework.
https://grpc-ecosystem.github.io/grpc-spring/
Apache License 2.0
3.48k stars 816 forks source link

UNAVAILABLE: io exception #865

Closed zhaiyutong closed 1 year ago

zhaiyutong commented 1 year ago

Hi team,

I have encountered some errors in my client part like it recently by using grpc

io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
    at io.grpc.Status.asRuntimeException(Status.java:535) ~[grpc-api-1.47.0.jar!/:1.47.0]
    at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:487) ~[grpc-stub-1.47.0.jar!/:1.47.0]
    at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:562) ~[grpc-core-1.47.0.jar!/:1.47.0]
    at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70) ~[grpc-core-1.47.0.jar!/:1.47.0]
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:743) ~[grpc-core-1.47.0.jar!/:1.47.0]
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:722) ~[grpc-core-1.47.0.jar!/:1.47.0]
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.47.0.jar!/:1.47.0]
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) ~[grpc-core-1.47.0.jar!/:1.47.0]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: io.grpc.netty.shaded.io.netty.channel.unix.Errors$NativeIoException: readAddress(..) failed: Connection timed out

io.grpc.StatusRuntimeException: UNAVAILABLE: Keepalive failed. The connection is likely gone
    at io.grpc.Status.asRuntimeException(Status.java:535) ~[grpc-api-1.47.0.jar!/:1.47.0]
    at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:487) ~[grpc-stub-1.47.0.jar!/:1.47.0]
    at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:562) ~[grpc-core-1.47.0.jar!/:1.47.0]
    at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70) ~[grpc-core-1.47.0.jar!/:1.47.0]
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:743) ~[grpc-core-1.47.0.jar!/:1.47.0]
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:722) ~[grpc-core-1.47.0.jar!/:1.47.0]
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.47.0.jar!/:1.47.0]
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) ~[grpc-core-1.47.0.jar!/:1.47.0]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]

I have confirmed that the server is working fine at the same time.

This is the setting in the client side

ManagedChannel channel =
        NettyChannelBuilder.forTarget(target, TlsChannelCredentials.create())
        .enableRetry()
        .maxRetryAttempts(3)
        .keepAliveTime(30, TimeUnit.SECONDS)
        .keepAliveTimeout(60, TimeUnit.SECONDS).build();

Could you provide me more insights how to avoid these problems?

ST-DDT commented 1 year ago

This looks like network errors to me. There is nothing I can do to help you with this error except for: