[rabbitmq-discuss] [rabbitmq-c-master] memory leakinkg while reconnect.
Rohit Patle
Rohit.Patle at techmahindra.com
Fri Feb 14 14:15:32 GMT 2014
Hi Alan,
Thank you for your suggestions.
As guided I run my simulation code in for() loop of 5 iterations.
A. Here in case of Valgrind I could not called amqp_destroy_connection() API after getting "opening SSL/TLS connection ERROR" because as network cable is plugged out It will produce the seg fault. I could see the memory leak there in this case.
B. In other case when I am trying to do amqp_destroy_connection() after getting "opening SSL/TLS connection ERROR". In this I am getting Seg fault as expected. I trace out the execution through GDB here is the bt you asked for.
Please suggest.
======================Valgrind===========================
==25028== HEAP SUMMARY:
==25028== in use at exit: 1,287,798 bytes in 3,852 blocks
==25028== total heap usage: 5,390 allocs, 1,538 frees, 1,509,595 bytes allocated
==25028==
==25028== Searching for pointers to 3,852 not-freed blocks
==25028== Checked 8,592,032 bytes
==25028==
==25028== Thread 1:
==25028== 136 bytes in 1 blocks are possibly lost in loss record 266 of 382
==25028== at 0x402A5E6: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==25028== by 0x4011304: allocate_dtv (dl-tls.c:297)
==25028== by 0x4011AAB: _dl_allocate_tls (dl-tls.c:461)
==25028== by 0x420D470: pthread_create@@GLIBC_2.1 (allocatestack.c:571)
==25028== by 0x8048C74: main (in /home/adminhu/amqps_listen)
==25028==
==25028== 65,536 bytes in 1 blocks are possibly lost in loss record 376 of 382
==25028== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==25028== by 0x402C007: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==25028== by 0x404C5C1: amqp_tune_connection (amqp_connection.c:152)
==25028== by 0x404C649: amqp_new_connection (amqp_connection.c:75)
==25028== by 0x420CD4B: start_thread (pthread_create.c:308)
==25028== by 0x414BBAD: clone (clone.S:130)
==25028==
==25028== 131,072 bytes in 1 blocks are possibly lost in loss record 378 of 382
==25028== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==25028== by 0x404C67B: amqp_new_connection (amqp_connection.c:89)
==25028== by 0x420CD4B: start_thread (pthread_create.c:308)
==25028== by 0x414BBAD: clone (clone.S:130)
==25028==
==25028== 632,852 (688 direct, 632,164 indirect) bytes in 4 blocks are definitely lost in loss record 382 of 382
==25028== at 0x402A5E6: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==25028== by 0x404C623: amqp_new_connection (amqp_connection.c:68)
==25028== by 0x420CD4B: start_thread (pthread_create.c:308)
==25028== by 0x414BBAD: clone (clone.S:130)
==25028==
==25028== LEAK SUMMARY:
==25028== definitely lost: 688 bytes in 4 blocks
==25028== indirectly lost: 632,164 bytes in 742 blocks
==25028== possibly lost: 196,744 bytes in 3 blocks
==25028== still reachable: 458,202 bytes in 3,103 blocks
==25028== suppressed: 0 bytes in 0 blocks
==25028== Reachable blocks (those to which a pointer was found) are not shown.
==25028== To see them, rerun with: --leak-check=full --show-reachable=yes
==25028==
==25028== Use --track-origins=yes to see where uninitialised values come from
==25028== ERROR SUMMARY: 17 errors from 6 contexts (suppressed: 0 from 0)
==25028==
==25028== 1 errors in context 1 of 6:
==25028== Thread 2:
==25028== Invalid read of size 4
==25028== at 0x4253643: SSL_write (ssl_lib.c:988)
==25028== by 0x8049AC3: ??? (in /home/adminhu/amqps_listen)
==25028== Address 0x4dff5b8 is 32 bytes inside a block of size 468 free'd
==25028== at 0x402B06C: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==25028== by 0x42B2919: CRYPTO_free (mem.c:397)
==25028== by 0x4256C80: SSL_free (ssl_lib.c:603)
==25028== by 0x4056318: amqp_ssl_socket_open (amqp_openssl.c:295)
==25028== by 0x404D8B4: amqp_socket_open (amqp_socket.c:185)
==25028== by 0x420CD4B: start_thread (pthread_create.c:308)
==25028== by 0x414BBAD: clone (clone.S:130)
==25028==
==25028==
==25028== 12 errors in context 2 of 6:
==25028== Conditional jump or move depends on uninitialised value(s)
==25028== at 0x4361494: ASN1_STRING_set (asn1_lib.c:382)
==25028== by 0x434AF02: ASN1_mbstring_ncopy (a_mbstr.c:204)
==25028== by 0x434B18A: ASN1_mbstring_copy (a_mbstr.c:86)
==25028== by 0x434C258: ASN1_STRING_to_UTF8 (a_strex.c:570)
==25028== by 0x434DF0B: x509_name_canon (x_name.c:408)
==25028== by 0x434E5BF: x509_name_ex_d2i (x_name.c:210)
==25028== by 0x4356017: ASN1_item_ex_d2i (tasn_dec.c:239)
==25028== by 0x4356D9E: asn1_template_noexp_d2i (tasn_dec.c:746)
==25028==
==25028== ERROR SUMMARY: 17 errors from 6 contexts (suppressed: 0 from 0)
============================END Valgrind==============
GDB:
=============================GDB===================
opening SSL/TLS connection
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7bc4b40 (LWP 25343)]
doall_util_fn (arg=0xb7bc4194, func_arg=0xb7dcdf80 <timeout_LHASH_DOALL_ARG>, func=0, use_arg=1,
lh=0xb721e090) at lhash.c:290
290 lhash.c: No such file or directory.
(gdb) bt
#0 doall_util_fn (arg=0xb7bc4194, func_arg=0xb7dcdf80 <timeout_LHASH_DOALL_ARG>, func=0, use_arg=1,
lh=0xb721e090) at lhash.c:290
#1 lh_doall_arg (lh=0xb721e090, func=0xb7dcdf80 <timeout_LHASH_DOALL_ARG>, arg=0xb7bc4194)
at lhash.c:307
#2 0xb7dcf1f3 in SSL_CTX_flush_sessions (s=0xb721de38, t=0) at ssl_sess.c:997
#3 0xb7dc93b1 in SSL_CTX_free (a=0xb721de38) at ssl_lib.c:1929
#4 SSL_CTX_free (a=0xb721de38) at ssl_lib.c:1897
#5 0xb7dcbc55 in SSL_free (s=0xb7220ac0) at ssl_lib.c:588
#6 0xb7fc1814 in amqp_ssl_socket_close (base=0xb7210520) at librabbitmq/amqp_openssl.c:306
#7 0xb7fc1870 in amqp_ssl_socket_delete (base=0xb7210520) at librabbitmq/amqp_openssl.c:334
#8 0xb7fb89b5 in amqp_socket_delete (self=0xb7210520) at librabbitmq/amqp_socket.c:201
#9 0xb7fb7740 in amqp_destroy_connection (state=0xb7200468) at librabbitmq/amqp_connection.c:183
#10 0x08049068 in Init ()
#11 0xb7df4d4c in start_thread (arg=0xb7bc4b40) at pthread_create.c:308
#12 0xb7ef9bae in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
=====================END GDB=========================
Thanks & Regards,
Rohit
________________________________
DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140214/3668077f/attachment.html>
More information about the rabbitmq-discuss
mailing list