Home > Back-end >  gRPC Server shutdown hangs forever
gRPC Server shutdown hangs forever

Time:09-17

Hello i have gRPC Asynchronous Server written in C .

I'm receiving rpc with AsyncNext that is ruining in it's own thread and currently it has deadline of 16ms.

i'm using suggested shutdown procedure

Server->Shutdown();
Que->Shutdown();
DrainQue();

Under normal conditions everything works fine, but when client sends rpc right before the shutdown and the keeps sending and never stops, AsyncNext never finishes until the client stops sending. this hangs the process even after it's "closed".

i would like to "kill" the gRPC Server under any state, if normal shutdown is unsuccessful. As not stopping the process introduces verity of unvented problems.

Edit: I'm using gPRC version - 1.40.x and Windows 10 as platform

CodePudding user response:

Turns out the the requests can be canceled with Context.TryCancel(); and in progress rpcs can be ended with Responder.FinishWithError(grpc::Status::CANCELLED, this);

Also i was not using AsyncNotifyWhenDone

  • Related