Hey there,

I've asked this question on StackOverflow
<https://stackoverflow.com/questions/46716024/graceful-shutdown-of-java-grpc-server-with-streams>,
but haven't got a response so decided to duplicate it here. :-)

I'm trying to add graceful shutdown for my GRPC service that has some
streaming APIs. Basically I want to wait for all GRPC calls to complete
before shutting down my application. Streaming calls can take up to several
minutes(big file uploads) and it seems current GRPC Java implementation is
not respecting such use case.

My service is implemented in Java and uses GRPC 1.7.0. So I simply call
grpcServer.shutdown() which according to the docs should: "Initiates an
orderly shutdown in which preexisting calls continue but new calls are
rejected." After it I immediately call grpcServer.awaitTermination() to
block until my services in TERMINATED state.

But I see that GRPC actually waits at most 5 seconds before sending service
in a TERMINATED state even though there are active streams.

So is seems grpcServer.shutdown() is not doing what the docs says it does
and I wonder what should I do to support my use case. I think GRPC should
support it(seems like a pretty common use case). If not I will need to
track active streams manually which is doable not looks more like a hack.

Best,
Fedor

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CANCeRsU9Wnp8u8_L-W6dOnkPvoPGsdNCyOh6%3Dq9S8SofoumbFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to