Replies: 4 comments 3 replies
-
I believe that the client gets an exception, which is
Yes,
Let me answer this question after I receive the answer to my first question.
I don't think so.
If you don't have to stream the request, you don't have to use bi-directional streaming. I believe that your case is just sending stream of data from the server to client when an event occurs so it's not the case.
The stream is closed if the underlying connection is closed. I think you need RetryingClient with CSLB instead if the problem occurs by the server crash. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the quick answer!
In a local test case i wrote, it behaved like this as well. But in a realistic environment for the mentioned service, we observed client side doesn't always get StatusRuntimeException with ClosedSessionException. Situation looks like this:
Do you recommend FutureStub or async stub then? Is the issue with blocking stub due to thread blocking (bad system resource utilization?)
That is true. Though I was thinking that it may be more flexible in the future we may want client side to push an update to client as well. And that it may lead to better system resource utilisation. Let me know whether my assessment isn't correct.
We plan to introduce retry logic on the client side on getting StatusRuntimeException. The issue was that we realize that we don't always/consistently get StatusRuntimeException for all cases (including server shutting down or crashing a) before sending any message to the open stream or b) after pushing any message to the open stream). Excuse my gap of knowledge here, how does Armeria handle temporary network issues. I know there is Channel concept. |
Beta Was this translation helpful? Give feedback.
-
By stream, I assume you mean a gRPC stream. (not HTTP/2 stream) If a server shutdown is initiated, the expected behavior is:
Logs on whether a GOAWAY frame has been sent/received can be verified by enabling debug logs for the following class:
Essentially, I think we need to know if the underlying connection isn't being closed, or just the request isn't being closed.
If a timeout is reached or either client/server initiates a channel close, the connection will be closed.
There isn't any automatic retry logic so an exception will be thrown. You would need to add a
Some timeouts like
Unfortunately, the docs at Armeria docs are all we have for now 😅 |
Beta Was this translation helpful? Give feedback.
-
I'm not really familiar with blocking stubs from server-side 😅 Blocking stubs from client-side should not matter though.
Client Side Load Balancing. |
Beta Was this translation helpful? Give feedback.
-
Hi,
We are using Armeria for gRPC communication. We encountered an issue about detecting/catching on the client when a stream is abandoned by a server (due to shutdown). We have a few questions.
Background
We are writing a server-streaming RPC in java and client side uses blocking gRPC.
The client nodes start a streaming gRPC with a server. Server keeps the stream observer open and sends messages to relevant open stream observers when it has events. We don't want the streams to timeout or be closed (unless there are network issues) neither on the client side nor on the client side, unless server or client nodes needs to shutdown.
Problem
Currently we are trying to figure out how to get a signal on client side when the server crashes, so that dangling streams can be cleaned-up on client side.
In a realistic environment, we observed that the client doesn't always get an exception when the server is killed (we tested actually graceful shutdown). When server is shutdown, the client gets an exception only when the server has sent a message via the stream before. The exception received on that case is
io.grpc.StatusRuntimeException: UNKNOWN
, cause:com.linecorp.armeria.common.ClosedSessionException
. We couldn't reproduce it in a test.Question-1: Is this working as intended? Do we have to set a client or server option to cover all the cases?
Question-2: We asked the same question in grpc-io forum and got this answer but i am not sure if it is relevant "Is gRPC keepalive enabled? It should help detect and close dead connections.". Should we set child channel option in this use case
serverBuilder.childChannelOption(ChannelOption.SO_KEEPALIVE, true)
?Question-2: Is blocking server side gRPC calls suitable for this use case? Should we use bi-directional streaming instead? Would it be more performant (not blocking threads on the client side). Would the above problem avoided in bi-directional streaming?
Question-3: Are there any client factory, stub or server options we should be aware of to avoid the streams getting closed too
I added more details about client and server side below.
Thank you,
Ugur
Details
Versions:
Service definition looks like this:
The client code looks like this:
How we create Armeria server and bind services:
We don't set any child options. We also don't override any other potentially relevant server connection options such as
pingIntervalMillis
(default value 0),maxConnectionAgeMillis
(default value 0, means infinite?) ,connectionDrainDurationMicros
(default value: 1000000L).On the client side ClientFactory creation:
On the client side stub creation:
Beta Was this translation helpful? Give feedback.
All reactions