You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "qhren (via GitHub)" <gi...@apache.org> on 2024/05/03 14:16:08 UTC
[I] serve 端通过channel 访问其他服务,内存持续缓慢上涨,疑似内存泄漏 (brpc)
qhren opened a new issue, #2633:
URL: https://github.com/apache/brpc/issues/2633
**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 时间:

内存占用对比差异:

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [I] server 端通过channel 访问其他服务,内存持续缓慢上涨,疑似内存泄漏 (brpc)
Posted by "qhren (via GitHub)" <gi...@apache.org>.
qhren closed issue #2633: server 端通过channel 访问其他服务,内存持续缓慢上涨,疑似内存泄漏
URL: https://github.com/apache/brpc/issues/2633
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
Re: [I] server 端通过channel 访问其他服务,内存持续缓慢上涨,疑似内存泄漏 (brpc)
Posted by "justforbalance (via GitHub)" <gi...@apache.org>.
justforbalance commented on issue #2633:
URL: https://github.com/apache/brpc/issues/2633#issuecomment-2814389835
请问这个问题您那边后续有定位到更具体的细节吗
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org