Juniper / grpc-c

C implementation of gRPC layered on top of core library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The server write function `context->gcc_writer->write()` still return success, when the client had been killed

lifeng68 opened this issue · comments

@ajhai
Hello :
I started a streaming server for test. My .proto file descriped the grpc service as below, the 'events' RPC is a streaming RPC.
I started the event grpc client, and the server wrote the responses to the client. The client got the responses successfully. But when I killed the client with (kill -9 PID), the server still sent the responses successfully, the function context->gcc_writer->write() returned 0.
In my opinion, when i killed the client with (kill -9 PID), the server write function context->gcc_writer->write() should return fail. But now , it still return success, is this a bug? Is there any other ways to check the connections with the clients?

service ContainerService {
	rpc Create(CreateRequest) returns (CreateResponse);
        rpc Start(StartRequest) returns (StartResponse);
        rpc Kill(KillRequest) returns (KillResponse);
	rpc Delete(DeleteRequest) returns (DeleteResponse);
	rpc Info(InfoRequest) returns (InfoResponse);
	rpc List(ListRequest) returns (ListResponse);
	rpc Events(EventsRequest) returns (stream Event);
}

@lifeng68 I have pushed some changes over weekend. You can now use grpc_c_context_is_call_cancelled(context) from server to check if client has disconnected. Ideally writer_write should return fail. If it is not doing that, it is a bug. Let me test it and add some examples around streaming. Also, I'm making some more changes. Expect things to break. I will reply on this thread when once I test streaming server.