keepalive not work with grpc

hunterqin nginx-forum at forum.nginx.org
Fri Aug 17 07:36:15 UTC 2018


I used protobuf v310, grpc v181, nginx v1152 and v1140.
The server is just same as the example async_server on grpc website. 
https://grpc.io/docs/tutorials/async/helloasync-cpp.html
You can use it directly.
https://github.com/grpc/grpc/blob/v1.14.1/examples/cpp/helloworld/greeter_async_server.cc

By the way, there is another problem found in nginx. Maybe you are intersted
in it.
After fixing the problem above, I tried more. The rpc service is simple, it
just transfers a short string(less than 10 bytes). At first, the grpc client
, nginx and grpc server works well together. But after some time, the
service stopped. I used the wireshark to check the problem. The last DATA
frame from nginx to grpc server is wrong. For example, in correct packet,
the DATA length is 13, message in protobuf is "Hunter", so the length of
string in protobuf is 6. 
protobuf part:
0a 06 48 75 6e 74 65 72.
But the last one is wrong, its DATA frame length is 10, it didn't send the
message completely
0a 06 48 75 6e.
Then the grpc server just send back a TCP ACK and ignore the wrong message,
finally nginx stop the TCP connection.
Then I test for longer string. When the string length is 1000bytes, it can
finish for about 4000 times. When the string length is 500bytes, it turns to
8000+times. I guess some problems may happen in nginx buffer. You could
check it , too.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,280765,280902#msg-280902



More information about the nginx mailing list