Closed qhren closed 1 week ago
Describe the bug (描述bug) 服务运行一段时间后,内存持续上涨
To Reproduce (复现方法) 链接tcmalloc,打开fno-omit-frame-pointer 编译选项 和 heap profiler,对比前后的内存占用diff,发现内存消耗在channel init和channel call调用。 下图中的sumit_post_request的基本结构如下:
baidu::rpc::Channel channel; baidu::rpc::ChannelOptions options; baidu::rpc::Controller cntl; options.protocol = baidu::rpc::PROTOCOL_HTTP; options.timeout_ms = 60000; options.max_retry = 3; if (channel.Init(uri.c_str(), "", &options) != 0) { CFATAL_LOG("init channel failed url = %s ", base_url.c_str()); return ErrorCode::ERROR; } cntl.http_request().set_method(baidu::rpc::HTTP_METHOD_POST); cntl.http_request().uri() = base_url; cntl.http_request().set_content_type("application/json"); // set content type cntl.request_attachment().append(data_json_str); channel.CallMethod(NULL, &cntl, NULL, NULL, NULL); if (cntl.Failed()) { CFATAL_LOG("rpc failed error text = %s", cntl.ErrorText().c_str()); ret_code = -1; return ErrorCode::ERROR; } o_res_json_str = cntl.response_attachment().to_string(); ret_code = 200; return ErrorCode::SUCCESS;
Expected behavior (期望行为) 内存在服务压力变化不大的情况下基本维持稳定
Versions (各种版本) OS:centos 6.3 Compiler: gcc12 brpc: stable 版本 protobuf: protobuf 2.4
Additional context/screenshots (更多上下文/截图) heap profiler 时间: 内存占用对比差异:
Describe the bug (描述bug) 服务运行一段时间后,内存持续上涨
To Reproduce (复现方法) 链接tcmalloc,打开fno-omit-frame-pointer 编译选项 和 heap profiler,对比前后的内存占用diff,发现内存消耗在channel init和channel call调用。 下图中的sumit_post_request的基本结构如下:
Expected behavior (期望行为) 内存在服务压力变化不大的情况下基本维持稳定
Versions (各种版本) OS:centos 6.3 Compiler: gcc12 brpc: stable 版本 protobuf: protobuf 2.4
Additional context/screenshots (更多上下文/截图) heap profiler 时间:
内存占用对比差异:
![image](https://github.com/apache/brpc/assets/40328739/0c68a846-20a4-4a02-a569-b91c6da98f01)