-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Description
What version of gRPC are you using?
761a6b364cb9e497a52e78286d686b1cd17d8ee3
What version of Go are you using (go version)?
1.9.2
What operating system (Linux, Windows, …) and version?
Ubuntu 16.04
What did you do?
There is a server that will return a large message body, the message body is always greater than 4M.
Then connect to the server, call the same remote function in a loop.
Server:
var message = strings.Repeat("hello", 1024*1024)
type server struct{}
func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
return &pb.HelloReply{Message: message}, nil
}Client:
function main() {
......
for {
_, err := c.SayHello(context.Background(), &pb.HelloRequest{})
if err != nil {
fmt.Println(err)
}
time.Sleep(time.Second)
}
}What did you expect to see?
Normal memory.
What did you see instead?
Client will print error like this :
"rpc error: code = ResourceExhausted desc = grpc: received message larger than max (5242885 vs. 4194304) ".
Worse, system memory grows quickly. Finally, the server will be killed.