ShaneTian opened a new issue #1429: URL: https://github.com/apache/incubator-brpc/issues/1429
**Describe the bug (描述bug)** 程序运行过程中压测发现内存持续上涨,经过 valgrind 检测之后发现多处 brpc 的 possibly lost **To Reproduce (复现方法)** ```cpp brpc::Server server; server.AddService(&us_service, brpc::SERVER_DOESNT_OWN_SERVICE, "/req => run") // ... ``` **Expected behavior (期望行为)** N/A **Versions (各种版本)** OS: `CentOS 7.5` Compiler: `gcc 7.3.1` brpc: [commit 2ae7f04ce513c6aee27545df49d5439a98ae3a3f](https://github.com/apache/incubator-brpc/tree/2ae7f04ce513c6aee27545df49d5439a98ae3a3f) protobuf: `2.5.0-8.el7` **Additional context/screenshots (更多上下文/截图)** ``` ==31231== 112 bytes in 1 blocks are possibly lost in loss record 1,597 of 2,257 ==31231== at 0x4C29583: operator new(unsigned long) (vg_replace_malloc.c:344) ==31231== by 0x7A6549: get_sampler (reducer.h:150) ==31231== by 0x7A6549: WindowBase (window.h:81) ==31231== by 0x7A6549: Window (window.h:181) ==31231== by 0x7A6549: bvar::detail::LatencyRecorderBase::LatencyRecorderBase(long) (latency_recorder.cpp:159) ==31231== by 0x6A196C: LatencyRecorder (latency_recorder.h:76) ==31231== by 0x6A196C: brpc::MethodStatus::MethodStatus() (method_status.cpp:30) ==31231== by 0x659941: brpc::Server::AddServiceInternal(google::protobuf::Service*, bool, brpc::ServiceOptions const&) (server.cpp:1151) ==31231== by 0x65ABC2: brpc::Server::AddService(google::protobuf::Service*, brpc::ServiceOwnership, butil::BasicStringPiece<std::string> const&) (server.cpp:1346) ==31231== 112 bytes in 1 blocks are possibly lost in loss record 1,601 of 2,257 ==31231== at 0x4C29583: operator new(unsigned long) (vg_replace_malloc.c:344) ==31231== by 0x7A64B9: get_sampler (percentile.h:473) ==31231== by 0x7A64B9: WindowBase (window.h:81) ==31231== by 0x7A64B9: Window (window.h:181) ==31231== by 0x7A64B9: bvar::detail::LatencyRecorderBase::LatencyRecorderBase(long) (latency_recorder.cpp:159) ==31231== by 0x6A196C: LatencyRecorder (latency_recorder.h:76) ==31231== by 0x6A196C: brpc::MethodStatus::MethodStatus() (method_status.cpp:30) ==31231== by 0x659941: brpc::Server::AddServiceInternal(google::protobuf::Service*, bool, brpc::ServiceOptions const&) (server.cpp:1151) ==31231== by 0x65ACC8: brpc::Server::AddBuiltinService(google::protobuf::Service*) (server.cpp:1357) ==31231== by 0x65AD79: brpc::Server::AddBuiltinServices() (server.cpp:432) ==31231== by 0x65DEE6: brpc::Server::StartInternal(in_addr const&, brpc::PortRange const&, brpc::ServerOptions const*) (server.cpp:839) ==31231== by 0x65ECFF: brpc::Server::Start(butil::EndPoint const&, brpc::ServerOptions const*) (server.cpp:999) ==31231== by 0x65EE5A: brpc::Server::Start(int, brpc::ServerOptions const*) (server.cpp:1017) ==31231== 840 bytes in 1 blocks are possibly lost in loss record 1,914 of 2,257 ==31231== at 0x4C29583: operator new(unsigned long) (vg_replace_malloc.c:344) ==31231== by 0x527F7D: expose_impl (passive_status.h:177) ==31231== by 0x527F7D: expose (variable.h:130) ==31231== by 0x527F7D: PassiveStatus (passive_status.h:83) ==31231== by 0x527F7D: __static_initialization_and_destruction_0 (key.cpp:264) ==31231== by 0x527F7D: _GLOBAL__sub_I_key.cpp (key.cpp:481) ==31231== by 0x847D1C: __libc_csu_init (in /root/uuk/_build/uuk) ==31231== by 0x6B5D424: (below main) (in /usr/lib64/libc-2.17.so) ==31231== 840 bytes in 1 blocks are possibly lost in loss record 1,915 of 2,257 ==31231== at 0x4C29583: operator new(unsigned long) (vg_replace_malloc.c:344) ==31231== by 0x83D475: expose_impl (passive_status.h:177) ==31231== by 0x83D475: expose (variable.h:130) ==31231== by 0x83D475: bvar::PassiveStatus<int>::PassiveStatus(butil::BasicStringPiece<std::string> const&, int (*)(void*), void*) (passive_status.h:83) ==31231== by 0x52E4AF: __static_initialization_and_destruction_0(int, int) [clone .constprop.120] (default_variables.cpp:659) ==31231== by 0x847D1C: __libc_csu_init (in /root/uuk/_build/uuk) ==31231== by 0x6B5D424: (below main) (in /usr/lib64/libc-2.17.so) ==31231== 840 bytes in 1 blocks are possibly lost in loss record 1,923 of 2,257 ==31231== at 0x4C29583: operator new(unsigned long) (vg_replace_malloc.c:344) ==31231== by 0x6A0DA9: expose_impl (passive_status.h:177) ==31231== by 0x6A0DA9: expose_as (variable.h:151) ==31231== by 0x6A0DA9: brpc::MethodStatus::Expose(butil::BasicStringPiece<std::string> const&) (method_status.cpp:37) ==31231== by 0x66091E: brpc::Server::UpdateDerivedVars(void*) (server.cpp:307) ==31231== by 0x61DD96: bthread::TaskGroup::task_runner(long) (task_group.cpp:293) ``` 其中一处问题怀疑为 [window.h](https://github.com/apache/incubator-brpc/blob/69e2d2a70f6c182cb674fbf23973bc1425ac324b/src/bvar/window.h#L87) 中析构函数没有析构 `_sampler` 指针? -- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
