<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
</head>
<body>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Hi Alan,<br>
<br>
Thank you for your suggestions. <br>
<br>
As guided I run my simulation code in for() loop of 5 iterations.<br>
<br>
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.
<br>
<br>
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.<br>
<br>
Please suggest.<br>
<br>
======================Valgrind===========================<br>
==25028== HEAP SUMMARY:<br>
==25028== in use at exit: 1,287,798 bytes in 3,852 blocks<br>
==25028== total heap usage: 5,390 allocs, 1,538 frees, 1,509,595 bytes allocated<br>
==25028== <br>
==25028== Searching for pointers to 3,852 not-freed blocks<br>
==25028== Checked 8,592,032 bytes<br>
==25028== <br>
==25028== Thread 1:<br>
==25028== 136 bytes in 1 blocks are possibly lost in loss record 266 of 382<br>
==25028== at 0x402A5E6: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)<br>
==25028== by 0x4011304: allocate_dtv (dl-tls.c:297)<br>
==25028== by 0x4011AAB: _dl_allocate_tls (dl-tls.c:461)<br>
==25028== by 0x420D470: pthread_create@@GLIBC_2.1 (allocatestack.c:571)<br>
==25028== by 0x8048C74: main (in /home/adminhu/amqps_listen)<br>
==25028== <br>
==25028== 65,536 bytes in 1 blocks are possibly lost in loss record 376 of 382<br>
==25028== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)<br>
==25028== by 0x402C007: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)<br>
==25028== by 0x404C5C1: amqp_tune_connection (amqp_connection.c:152)<br>
==25028== by 0x404C649: amqp_new_connection (amqp_connection.c:75)<br>
==25028== by 0x420CD4B: start_thread (pthread_create.c:308)<br>
==25028== by 0x414BBAD: clone (clone.S:130)<br>
==25028== <br>
==25028== 131,072 bytes in 1 blocks are possibly lost in loss record 378 of 382<br>
==25028== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)<br>
==25028== by 0x404C67B: amqp_new_connection (amqp_connection.c:89)<br>
==25028== by 0x420CD4B: start_thread (pthread_create.c:308)<br>
==25028== by 0x414BBAD: clone (clone.S:130)<br>
==25028== <br>
==25028== 632,852 (688 direct, 632,164 indirect) bytes in 4 blocks are definitely lost in loss record 382 of 382<br>
==25028== at 0x402A5E6: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)<br>
==25028== by 0x404C623: amqp_new_connection (amqp_connection.c:68)<br>
==25028== by 0x420CD4B: start_thread (pthread_create.c:308)<br>
==25028== by 0x414BBAD: clone (clone.S:130)<br>
==25028== <br>
==25028== LEAK SUMMARY:<br>
==25028== <span style="background-color:rgb(255,255,0)"> definitely lost: 688 bytes in 4 blocks</span><br>
==25028== indirectly lost: 632,164 bytes in 742 blocks<br>
==25028== possibly lost: 196,744 bytes in 3 blocks<br>
==25028== still reachable: 458,202 bytes in 3,103 blocks<br>
==25028== suppressed: 0 bytes in 0 blocks<br>
==25028== Reachable blocks (those to which a pointer was found) are not shown.<br>
==25028== To see them, rerun with: --leak-check=full --show-reachable=yes<br>
==25028== <br>
==25028== Use --track-origins=yes to see where uninitialised values come from<br>
==25028== ERROR SUMMARY: 17 errors from 6 contexts (suppressed: 0 from 0)<br>
==25028== <br>
==25028== 1 errors in context 1 of 6:<br>
==25028== Thread 2:<br>
==25028== Invalid read of size 4<br>
==25028== at 0x4253643: SSL_write (ssl_lib.c:988)<br>
==25028== by 0x8049AC3: ??? (in /home/adminhu/amqps_listen)<br>
==25028== Address 0x4dff5b8 is 32 bytes inside a block of size 468 free'd<br>
==25028== at 0x402B06C: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)<br>
==25028== by 0x42B2919: CRYPTO_free (mem.c:397)<br>
==25028== by 0x4256C80: SSL_free (ssl_lib.c:603)<br>
==25028== by 0x4056318: amqp_ssl_socket_open (amqp_openssl.c:295)<br>
==25028== by 0x404D8B4: amqp_socket_open (amqp_socket.c:185)<br>
==25028== by 0x420CD4B: start_thread (pthread_create.c:308)<br>
==25028== by 0x414BBAD: clone (clone.S:130)<br>
==25028== <br>
==25028== <br>
==25028== 12 errors in context 2 of 6:<br>
==25028== Conditional jump or move depends on uninitialised value(s)<br>
==25028== at 0x4361494: ASN1_STRING_set (asn1_lib.c:382)<br>
==25028== by 0x434AF02: ASN1_mbstring_ncopy (a_mbstr.c:204)<br>
==25028== by 0x434B18A: ASN1_mbstring_copy (a_mbstr.c:86)<br>
==25028== by 0x434C258: ASN1_STRING_to_UTF8 (a_strex.c:570)<br>
==25028== by 0x434DF0B: x509_name_canon (x_name.c:408)<br>
==25028== by 0x434E5BF: x509_name_ex_d2i (x_name.c:210)<br>
==25028== by 0x4356017: ASN1_item_ex_d2i (tasn_dec.c:239)<br>
==25028== by 0x4356D9E: asn1_template_noexp_d2i (tasn_dec.c:746)<br>
==25028== <br>
==25028== ERROR SUMMARY: 17 errors from 6 contexts (suppressed: 0 from 0)<br>
============================END Valgrind==============<br>
<br>
GDB:<br>
<br>
=============================GDB===================<br>
opening SSL/TLS connection<br>
<br>
Program received signal SIGSEGV, Segmentation fault.<br>
[Switching to Thread 0xb7bc4b40 (LWP 25343)]<br>
doall_util_fn (arg=0xb7bc4194, func_arg=0xb7dcdf80 <timeout_LHASH_DOALL_ARG>, func=0, use_arg=1,
<br>
lh=0xb721e090) at lhash.c:290<br>
290 lhash.c: No such file or directory.<br>
(gdb) bt<br>
#0 doall_util_fn (arg=0xb7bc4194, func_arg=0xb7dcdf80 <timeout_LHASH_DOALL_ARG>, func=0, use_arg=1,
<br>
lh=0xb721e090) at lhash.c:290<br>
#1 lh_doall_arg (lh=0xb721e090, func=0xb7dcdf80 <timeout_LHASH_DOALL_ARG>, arg=0xb7bc4194)<br>
at lhash.c:307<br>
#2 0xb7dcf1f3 in SSL_CTX_flush_sessions (s=0xb721de38, t=0) at ssl_sess.c:997<br>
#3 0xb7dc93b1 in SSL_CTX_free (a=0xb721de38) at ssl_lib.c:1929<br>
#4 SSL_CTX_free (a=0xb721de38) at ssl_lib.c:1897<br>
#5 0xb7dcbc55 in SSL_free (s=0xb7220ac0) at ssl_lib.c:588<br>
#6 0xb7fc1814 in amqp_ssl_socket_close (base=0xb7210520) at librabbitmq/amqp_openssl.c:306<br>
#7 0xb7fc1870 in amqp_ssl_socket_delete (base=0xb7210520) at librabbitmq/amqp_openssl.c:334<br>
#8 0xb7fb89b5 in amqp_socket_delete (self=0xb7210520) at librabbitmq/amqp_socket.c:201<br>
#9 0xb7fb7740 in amqp_destroy_connection (state=0xb7200468) at librabbitmq/amqp_connection.c:183<br>
#10 0x08049068 in Init ()<br>
#11 0xb7df4d4c in start_thread (arg=0xb7bc4b40) at pthread_create.c:308<br>
#12 0xb7ef9bae in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130<br>
=====================END GDB=========================<br>
<br>
Thanks & Regards,<br>
Rohit<br>
<br>
</div>
<br>
<hr>
<font face="Arial" color="Navy" size="2"><br>
DISCLAIMER:<br>
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.<br>
</font>
</body>
</html>