You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/07/07 02:49:50 UTC

[GitHub] [rocketmq-client-cpp] ChrisZhangJin commented on issue #430: Memory leak in TcpTransport::getInetAddr

ChrisZhangJin commented on issue #430:
URL: https://github.com/apache/rocketmq-client-cpp/issues/430#issuecomment-1176984905

   the leak happens only when using CProducer while setting server with a domian not a IP;
   I also tried cpp class DefaultMQProducer, it's totally ok without it.
   
   it seems c-based interface has such leaks
   
   the code like this
   ` SetProducerNameServerAddress(producer, "some.domain.com:9876");` 
   
   found version:
   2.2.0
   
   here is the result from Valgrind
   
   > ==12866== 5,760 (960 direct, 4,800 indirect) bytes in 15 blocks are definitely lost in loss record 7 of 9
   ==12866==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
   ==12866==    by 0x6361E8A: gaih_inet.constprop.8 (in /usr/lib64/libc-2.17.so)
   ==12866==    by 0x63635F3: getaddrinfo (in /usr/lib64/libc-2.17.so)
   ==12866==    by 0x53C7B38: evutil_getaddrinfo (in /usr/lib64/librocketmq.so)
   ==12866==    by 0x5379357: rocketmq::TcpTransport::getInetAddr(std::string&) (TcpTransport.cpp:105)
   ==12866==    by 0x5379672: rocketmq::TcpTransport::connect(std::string const&, int) (TcpTransport.cpp:160)
   ==12866==    by 0x536ACEA: rocketmq::TcpRemotingClient::CreateTransport(std::string const&, bool) (TcpRemotingClient.cpp:339)
   ==12866==    by 0x536B068: rocketmq::TcpRemotingClient::CreateNameServerTransport(bool) (TcpRemotingClient.cpp:390)
   ==12866==    by 0x536A989: rocketmq::TcpRemotingClient::GetTransport(std::string const&, bool) (TcpRemotingClient.cpp:293)
   ==12866==    by 0x536A134: rocketmq::TcpRemotingClient::invokeSync(std::string const&, rocketmq::RemotingCommand&, int) (TcpRemotingClient.cpp:203)
   ==12866==    by 0x5243C2C: rocketmq::MQClientAPIImpl::getTopicRouteInfoFromNameServer(std::string const&, int, rocketmq::SessionCredentials const&) (MQClientAPIImpl.cpp:315)
   ==12866==    by 0x5257CA3: rocketmq::MQClientFactory::updateTopicRouteInfoFromNameServer(std::string const&, rocketmq::SessionCredentials const&, bool) (MQClientFactory.cpp:172)
   ==12866==
   ==12866== 7,296 (1,216 direct, 6,080 indirect) bytes in 19 blocks are definitely lost in loss record 9 of 9
   ==12866==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
   ==12866==    by 0x6361E8A: gaih_inet.constprop.8 (in /usr/lib64/libc-2.17.so)
   ==12866==    by 0x63635F3: getaddrinfo (in /usr/lib64/libc-2.17.so)
   ==12866==    by 0x53C7B38: evutil_getaddrinfo (in /usr/lib64/librocketmq.so)
   ==12866==    by 0x5379357: rocketmq::TcpTransport::getInetAddr(std::string&) (TcpTransport.cpp:105)
   ==12866==    by 0x5379672: rocketmq::TcpTransport::connect(std::string const&, int) (TcpTransport.cpp:160)
   ==12866==    by 0x536ACEA: rocketmq::TcpRemotingClient::CreateTransport(std::string const&, bool) (TcpRemotingClient.cpp:339)
   ==12866==    by 0x536B068: rocketmq::TcpRemotingClient::CreateNameServerTransport(bool) (TcpRemotingClient.cpp:390)
   ==12866==    by 0x536A989: rocketmq::TcpRemotingClient::GetTransport(std::string const&, bool) (TcpRemotingClient.cpp:293)
   ==12866==    by 0x536A134: rocketmq::TcpRemotingClient::invokeSync(std::string const&, rocketmq::RemotingCommand&, int) (TcpRemotingClient.cpp:203)
   ==12866==    by 0x5243C2C: rocketmq::MQClientAPIImpl::getTopicRouteInfoFromNameServer(std::string const&, int, rocketmq::SessionCredentials const&) (MQClientAPIImpl.cpp:315)
   ==12866==    by 0x5257DDA: rocketmq::MQClientFactory::updateTopicRouteInfoFromNameServer(std::string const&, rocketmq::SessionCredentials const&, bool) (MQClientFactory.cpp:184)
   


-- 
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@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org