ehds opened a new issue, #2164: URL: https://github.com/apache/brpc/issues/2164
**Describe the bug (描述bug)** 在 Server::StartInternal 中,`_keytable_pool` 和 `_session_local_data_pool` 通过 new 来分配内存,在 Server 析构时,会调用 `Join` 函数来释放其资源。 但是`Join`只有当 `_status != RUNNING && _status != STOPPING` 时才会进入析构的逻辑。 https://github.com/apache/brpc/blob/fc885ad37d5a1dfae47f1a32d899569b55376dab/src/brpc/server.cpp#L1187-L1190 所以如果在 `Server::StartInternal` 中如果状态未成为 `RUNNING` (由于 BuildAcceptor 失败等),那么其分配的内存无法被释放。 **To Reproduce (复现方法)** 开启ASAN检测,使 BuildAcceptor 失败(设置一个被占用的端口等),会检测出 memory leak 错误。 **Expected behavior (期望行为)** 即使 Server start 失败,应该不会内存泄漏发生。 **Versions (各种版本)** OS: Compiler: brpc: protobuf: **Additional context/screenshots (更多上下文/截图)** -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
