qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Moravec (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (QPID-5872) [C++ client] Memory leak in qpid::messaging::amqp::ConnectionContext::ConnectionContext when using qpid-receive
Date Tue, 08 Jul 2014 13:17:05 GMT

    [ https://issues.apache.org/jira/browse/QPID-5872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14054922#comment-14054922
] 

Pavel Moravec commented on QPID-5872:
-------------------------------------

Some other leaks when closing session with open receiver there. To reproduce, apply this patch:

{noformat}
Index: ../src/tests/qpid-receive.cpp
===================================================================
--- ../src/tests/qpid-receive.cpp	(revision 1608083)
+++ ../src/tests/qpid-receive.cpp	(working copy)
@@ -195,6 +195,7 @@
             connection = Connection(opts.url, opts.connectionOptions);
             connection.open();
             std::auto_ptr<FailoverUpdates> updates(opts.failoverUpdates ? new FailoverUpdates(connection)
: 0);
+for (int ii=0; ii<1000; ii++) {
             Session session = opts.tx ? connection.createTransactionalSession() : connection.createSession();
             Receiver receiver = session.createReceiver(opts.address);
             receiver.setCapacity(opts.capacity);
@@ -287,6 +288,7 @@
                 session.acknowledge();
             }
             session.close();
+}
             connection.close();
             return 0;
         }
{noformat}

And then run:

valgrind --leak-check=full ./qpid-receive --connection-options "{protocol:amqp1.0}" --print-headers
true --messages 1 --address q

with output like:

{noformat}
==18796== 226,344 (1,024 direct, 225,320 indirect) bytes in 2 blocks are definitely lost in
loss record 586 of 616
==18796==    at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18796==    by 0x3710815868: pni_map_allocate (object.c:425)
==18796==    by 0x371081634E: pn_map (object.c:477)
==18796==    by 0x3710816A9C: pn_hash (object.c:674)
==18796==    by 0x3710821044: pn_session (engine.c:735)
==18796==    by 0x4C5A71C: qpid::messaging::amqp::ConnectionContext::newSession(bool, std::string
const&) (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x4C68FBE: qpid::messaging::amqp::ConnectionHandle::newSession(bool, std::string
const&) (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x4CC6F3F: qpid::messaging::Connection::createSession(std::string const&)
(in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x40CDEB: main (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/tests/qpid-receive)
==18796==
==18796== 565,860 (240 direct, 565,620 indirect) bytes in 5 blocks are definitely lost in
loss record 592 of 616
==18796==    at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18796==    by 0x3710815961: pn_new (object.c:41)
==18796==    by 0x371081625A: pn_list (object.c:359)
==18796==    by 0x3710820F72: pn_session (engine.c:721)
==18796==    by 0x4C5A71C: qpid::messaging::amqp::ConnectionContext::newSession(bool, std::string
const&) (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x4C68FBE: qpid::messaging::amqp::ConnectionHandle::newSession(bool, std::string
const&) (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x4CC6F3F: qpid::messaging::Connection::createSession(std::string const&)
(in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x40CDEB: main (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/tests/qpid-receive)
==18796==
==18796== 12,157,572 (57,552 direct, 12,100,020 indirect) bytes in 109 blocks are definitely
lost in loss record 613 of 616
==18796==    at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18796==    by 0x3710815961: pn_new (object.c:41)
==18796==    by 0x3710821293: pn_link_new (engine.c:817)
==18796==    by 0x4C6BE97: qpid::messaging::amqp::ReceiverContext::ReceiverContext(pn_session_t*,
std::string const&, qpid::messaging::Address const&) (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x4C76BA1: qpid::messaging::amqp::SessionContext::createReceiver(qpid::messaging::Address
const&) (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x4C7DE8B: qpid::messaging::amqp::SessionHandle::createReceiver(qpid::messaging::Address
const&) (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x4CCDC1D: qpid::messaging::Session::createReceiver(std::string const&)
(in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x40CE36: main (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/tests/qpid-receive)
==18796==
==18796== 63,013,928 (152,864 direct, 62,861,064 indirect) bytes in 562 blocks are definitely
lost in loss record 616 of 616
==18796==    at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18796==    by 0x3710815961: pn_new (object.c:41)
==18796==    by 0x3710820F42: pn_session (engine.c:716)
==18796==    by 0x4C5A71C: qpid::messaging::amqp::ConnectionContext::newSession(bool, std::string
const&) (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x4C68FBE: qpid::messaging::amqp::ConnectionHandle::newSession(bool, std::string
const&) (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x4CC6F3F: qpid::messaging::Connection::createSession(std::string const&)
(in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
==18796==    by 0x40CDEB: main (in /home/pmoravec/qpid-trunk/qpid/cpp/BLD/src/tests/qpid-receive)
==18796==
{noformat}

> [C++ client] Memory leak in qpid::messaging::amqp::ConnectionContext::ConnectionContext
when using qpid-receive
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-5872
>                 URL: https://issues.apache.org/jira/browse/QPID-5872
>             Project: Qpid
>          Issue Type: Bug
>          Components: C++ Client
>    Affects Versions: 0.29
>            Reporter: Pavel Moravec
>            Assignee: Pavel Moravec
>            Priority: Minor
>              Labels: memory-leak, memory_leak
>
> valgrind shows a memory leak like below:
> {noformat}
> qpid-send --messages 3000 --address "q;{create:sender}"
> valgrind --leak-check=full ./src/tests/qpid-receive --connection-options {protocol:amqp1.0}
--messages 1 --address q
> ==1206== Memcheck, a memory error detector
> ==1206== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
> ==1206== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
> ==1206== Command: ./src/tests/qpid-receive --connection-options {protocol:amqp1.0} --messages
1 --address q
> ==1206== 
> ==1206== 
> ==1206== HEAP SUMMARY:
> ==1206==     in use at exit: 173,792 bytes in 376 blocks
> ==1206==   total heap usage: 84,019 allocs, 83,643 frees, 15,026,997 bytes allocated
> ==1206== 
> ==1206== 157,964 (256 direct, 157,708 indirect) bytes in 1 blocks are definitely lost
in loss record 339 of 339
> ==1206==    at 0x4A069EE: malloc (vg_replace_malloc.c:270)
> ==1206==    by 0x3CAA617029: pn_new (object.c:41)
> ==1206==    by 0x3CAA623041: pn_connection (engine.c:384)
> ==1206==    by 0x4C55425: qpid::messaging::amqp::ConnectionContext::ConnectionContext(std::string
const&, std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string
const, qpid::types::Variant> > > const&) (in /data_xfs/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
> ==1206==    by 0x4C6B24D: qpid::messaging::amqp::ConnectionHandle::ConnectionHandle(std::string
const&, std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string
const, qpid::types::Variant> > > const&) (in /data_xfs/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
> ==1206==    by 0x4C6AEB7: qpid::messaging::amqp::(anonymous namespace)::create(std::string
const&, std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string
const, qpid::types::Variant> > > const&) (in /data_xfs/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
> ==1206==    by 0x4CDA4DB: qpid::messaging::ProtocolRegistry::create(std::string const&,
std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string
const, qpid::types::Variant> > > const&) (in /data_xfs/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
> ==1206==    by 0x4CCF362: qpid::messaging::Connection::Connection(std::string const&,
std::string const&) (in /data_xfs/qpid/cpp/BLD/src/libqpidmessaging.so.2.0.0)
> ==1206==    by 0x40C707: main (in /data_xfs/qpid/cpp/BLD/src/tests/qpid-receive)
> ==1206== 
> ==1206== LEAK SUMMARY:
> ==1206==    definitely lost: 256 bytes in 1 blocks
> ==1206==    indirectly lost: 157,708 bytes in 330 blocks
> ==1206==      possibly lost: 0 bytes in 0 blocks
> ==1206==    still reachable: 15,828 bytes in 45 blocks
> ==1206==         suppressed: 0 bytes in 0 blocks
> ==1206== Reachable blocks (those to which a pointer was found) are not shown.
> ==1206== To see them, rerun with: --leak-check=full --show-reachable=yes
> ==1206== 
> ==1206== For counts of detected and suppressed errors, rerun with: -v
> ==1206== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 36 from 9)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message