baidu / braft

An industrial-grade C++ implementation of RAFT consensus algorithm based on brpc, widely used inside Baidu to build highly-available distributed systems.
Apache License 2.0
3.95k stars 881 forks source link

Memory leak in atomic server #393

Open jerrytesting opened 1 year ago

jerrytesting commented 1 year ago

We found one memory leak bug while running atomic-server. Here is the bug report from the sanitizer:

Direct leak of 56 byte(s) in 1 object(s) allocated from:
--
#0 0x71f63d in operator new(unsigned long) (/opt/fs/braft/example/atomic/atomic_server+0x71f63d)
#1 0xd4f40f in brpc::Server::StartInternal(butil::EndPoint const&, brpc::PortRange const&, brpc::ServerOptions const*) /opt/fs/brpc/src/brpc/server.cpp:834:22
#2 0xd5249f in brpc::Server::Start(butil::EndPoint const&, brpc::ServerOptions const*) /opt/fs/brpc/src/brpc/server.cpp:1131:12
#3 0xd5249f in brpc::Server::Start(int, brpc::ServerOptions const*) /opt/fs/brpc/src/brpc/server.cpp:1150:12
#4 0x72331e in main /opt/fs/braft/example/atomic/server.cpp:501:16
#5 0x7ffff719b09a in __libc_start_main /build/glibc-6iIyft/glibc-2.28/csu/../csu/libc-start.c:308:16
 
SUMMARY: AddressSanitizer: 56 byte(s) leaked in 1 allocation(s).
ehds commented 1 year ago

related issue: https://github.com/apache/brpc/issues/2164