apache / apache/brpc

brpc http_c++示例代码修改 server端接收后创建clinet发送数据发现可能存在内存泄露

Open
#2,502 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
17.6k
Forks
4.1k
Avg merge
2d 12h
Merged PRs (30d)
69

Description

**Describe the bug (描述bug)**
http brpc server端接收后创建client发送数据,内存泄露

**To Reproduce (复现方法)**
基于Release1.7.0 brpc代码修改brpc http_c++示例代码;
1、在收到客户端访问v1/queue/stats 后开辟线程做一次brpc send(v1/start)
![image](https://github.com/apache/brpc/assets/156296108/20d4462d-a120-4243-8943-f6c3153039aa)
2、客户端每执行一次,server进程都有20KB左右物理内存增加
./http_client http://kkuser-virtual-machine:8010/v1/queue/stats
![image](https://github.com/apache/brpc/assets/156296108/af0c4441-3205-45e1-bcf5-639ab6b2fae8)

**Expected behavior (期望行为)**
内存不会持续增加

**Versions (各种版本)**
OS:
Compiler:
brpc: V1.7.0
protobuf:3.14.0

**Additional context/screenshots (更多上下文/截图)**
![image](https://github.com/apache/brpc/assets/156296108/da8bb6fb-536d-4b7c-85f7-d2af8defd974)

Contributor guide

Open the contributing guide

Research direction

Start with the modified brpc http_c++ example on Release 1.7.0 and reproduce repeated requests to v1/queue/stats, which starts a brpc send to v1/start. Compare server memory after each request and inspect the request, thread, and client lifecycle; done means the server process no longer grows continuously under the reported sequence.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.