Memory Leakage in gRPC Server

146 views
Skip to first unread message

AmirM

unread,
Sep 22, 2021, 9:57:26 PM9/22/21
to grpc.io
Hi

I wrapped a c++ gRPC server in a docker, and I observed when every time I ran the server docker, memory usage would increase and never went down. Valgrind did not report any leakage when I started and stopped the server from getting the report. 

==464== LEAK SUMMARY:
==464==    definitely lost: 0 bytes in 0 blocks
==464==    indirectly lost: 0 bytes in 0 blocks
==464==      possibly lost: 2,560 bytes in 8 blocks
==464==    still reachable: 520,878 bytes in 5,998 blocks
==464==                       of which reachable via heuristic:
==464==                         newarray           : 1,088 bytes in 2 blocks
==464==         suppressed: 0 bytes in 0 blocks

The code I is as simple as below:

class MathematicalOptimizationServiceImpl final : public mathematical_optimization::v1alpha1::MathematicalOptimizationService::Service {

Status SolveMPModel(ServerContext* context, const MPModelRequest* request, MPSolutionResponse* response) override {
operations_research::MPSolver::SolveWithProto(*request, response);
return Status::OK;
}

};

void RunServer() {
std::string server_address("0.0.0.0:5050");
MathematicalOptimizationServiceImpl service;

ServerBuilder builder;

builder.SetMaxReceiveMessageSize(1024 * 1024 * 256);
builder.SetMaxSendMessageSize(1024 * 1024 * 256);
builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
builder.RegisterService(&service);
std::unique_ptr<Server> server(builder.BuildAndStart());
std::cout << "Server listening on " << server_address << std::endl;
server->Wait();
}

int main(int argc, char** argv) {
RunServer();

return 0;
}

Thanks for your help.

veb...@google.com

unread,
May 26, 2022, 12:47:32 PM5/26/22
to grpc.io
Would you give a small repro we can run and the output of full leak report to know what's leaked?
Reply all
Reply to author
Forward
0 new messages