<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
In my application I've a erlang node which periodically communicates
with the<br>
C-node every 1 second to gather periodic data such as alarm and
performance.<br>
<br>
The C-node is implemented in such a way that, it consists of two
threads, one<br>
thread receives the requests from the erlang node and the other
thread serves the<br>
queries and replies to erlang node. To reply to the erlang node all
the<br>
data that is collected in the cnode need to converted to erlang
format<br>
(in my case to a list of tuples) using the function erl_format.<br>
<br>
The problem observed here is, after running for approximately 45
minutes, <br>
I'm incurring a glibc error which complains about a memory
corruption.<br>
<br>
What could be the probable cause for this?<br>
<br>
I'm using the 3.9 version of the erl_interface libraries which are
compiled<br>
with thread safe options(such as _REENTRANT)<br>
<br>
Please find below the log that I got where glibc complains about a
possible<br>
memory corruption<br>
<br>
When I did a addr2line on the address 0x101bb12c it pointed to the
erl_format()<br>
<br>
<font face="DejaVu Sans Mono">*** glibc detected ***
/root/rel-1.0.0/galaxy/lib/galaxy-1.6.0/priv/hyphy_cnode:
malloc(): memory corruption (fast): 0x1021fb08 ***<br>
======= Backtrace: =========<br>
/lib/libc.so.6[0xfd84610]<br>
/lib/libc.so.6[0xfd864fc]<br>
/lib/libc.so.6(__libc_malloc+0xb4)[0xfd887b8]<br>
/root/rel-1.0.0/galaxy/lib/galaxy-1.6.0/priv/hyphy_cnode(erl_eterm_alloc+0xac)[0x101ba1fc]<br>
/root/rel-1.0.0/galaxy/lib/galaxy-1.6.0/priv/hyphy_cnode(erl_alloc_eterm+0x2c)[0x101bb848]<br>
/root/rel-1.0.0/galaxy/lib/galaxy-1.6.0/priv/hyphy_cnode(erl_mk_tuple+0x94)[0x101b88c0]<br>
/root/rel-1.0.0/galaxy/lib/galaxy-1.6.0/priv/hyphy_cnode[0x101baf00]<br>
/root/rel-1.0.0/galaxy/lib/galaxy-1.6.0/priv/hyphy_cnode[0x101bb1bc]<br>
/root/rel-1.0.0/galaxy/lib/galaxy-1.6.0/priv/hyphy_cnode[0x101baf58]<br>
/root/rel-1.0.0/galaxy/lib/galaxy-1.6.0/priv/hyphy_cnode[0x101bb300]<br>
/root/rel-1.0.0/galaxy/lib/galaxy-1.6.0/priv/hyphy_cnode[0x101baee8]<br>
/root/rel-1.0.0/galaxy/lib/galaxy-1.6.0/priv/hyphy_cnode(erl_format+0x7c)[0x101bb12c]<br>
/root/rel-1.0.0/galaxy/lib/galaxy-1.6.0/priv/hyphy_cnode(query_handler+0x4264)[0x100235fc]<br>
/lib/libpthread.so.0[0xff967f4]<br>
/lib/libc.so.6(clone+0x8c)[0xfde226c]<br>
======= Memory map: ========<br>
00100000-00103000 r-xp 00100000 00:00 0 [vdso]<br>
0fc31000-0fc41000 r-xp 00000000 fd:01 3213
/lib/libresolv-2.5.so<br>
0fc41000-0fc50000 ---p 00010000 fd:01 3213
/lib/libresolv-2.5.so<br>
0fc50000-0fc51000 r--p 0000f000 fd:01 3213
/lib/libresolv-2.5.so<br>
0fc51000-0fc52000 rwxp 00010000 fd:01 3213
/lib/libresolv-2.5.so<br>
0fc52000-0fc54000 rwxp 0fc52000 00:00 0 <br>
0fc64000-0fc68000 r-xp 00000000 fd:01 3214
/lib/libnss_dns-2.5.so<br>
0fc68000-0fc77000 ---p 00004000 fd:01 3214
/lib/libnss_dns-2.5.so<br>
0fc77000-0fc78000 r--p 00003000 fd:01 3214
/lib/libnss_dns-2.5.so<br>
0fc78000-0fc79000 rwxp 00004000 fd:01 3214
/lib/libnss_dns-2.5.so<br>
0fc89000-0fc93000 r-xp 00000000 fd:01 3223
/lib/libnss_nis-2.5.so<br>
0fc93000-0fca2000 ---p 0000a000 fd:01 3223
/lib/libnss_nis-2.5.so<br>
0fca2000-0fca3000 r--p 00009000 fd:01 3223
/lib/libnss_nis-2.5.so<br>
0fca3000-0fca4000 rwxp 0000a000 fd:01 3223
/lib/libnss_nis-2.5.so<br>
0fcb4000-0fcc0000 r-xp 00000000 fd:01 3243
/lib/libnss_nisplus-2.5.so<br>
0fcc0000-0fccf000 ---p 0000c000 fd:01 3243
/lib/libnss_nisplus-2.5.so<br>
0fccf000-0fcd0000 r--p 0000b000 fd:01 3243
/lib/libnss_nisplus-2.5.so<br>
0fcd0000-0fcd1000 rwxp 0000c000 fd:01 3243
/lib/libnss_nisplus-2.5.so<br>
0fce1000-0fceb000 r-xp 00000000 fd:01 3240
/lib/libnss_files-2.5.so<br>
0fceb000-0fcfa000 ---p 0000a000 fd:01 3240
/lib/libnss_files-2.5.so<br>
0fcfa000-0fcfb000 r--p 00009000 fd:01 3240
/lib/libnss_files-2.5.so<br>
0fcfb000-0fcfc000 rwxp 0000a000 fd:01 3240
/lib/libnss_files-2.5.so<br>
0fd0c000-0fe49000 r-xp 00000000 fd:01 3215 /lib/libc-2.5.so<br>
0fe49000-0fe59000 ---p 0013d000 fd:01 3215 /lib/libc-2.5.so<br>
0fe59000-0fe5b000 r--p 0013d000 fd:01 3215 /lib/libc-2.5.so<br>
0fe5b000-0fe5e000 rwxp 0013f000 fd:01 3215 /lib/libc-2.5.so<br>
0fe5e000-0fe61000 rwxp 0fe5e000 00:00 0 <br>
0fe71000-0fe7a000 r-xp 00000000 fd:01 3272 /lib/librt-2.5.so<br>
0fe7a000-0fe89000 ---p 00009000 fd:01 3272 /lib/librt-2.5.so<br>
0fe89000-0fe8a000 r--p 00008000 fd:01 3272 /lib/librt-2.5.so<br>
0fe8a000-0fe8b000 rwxp 00009000 fd:01 3272 /lib/librt-2.5.so<br>
0fe8b000-0fe96000 rwxp 0fe8b000 00:00 0 <br>
0fea6000-0ff49000 r-xp 00000000 fd:01 3211 /lib/libm-2.5.so<br>
0ff49000-0ff58000 ---p 000a3000 fd:01 3211 /lib/libm-2.5.so<br>
0ff58000-0ff59000 r--p 000a2000 fd:01 3211 /lib/libm-2.5.so<br>
0ff59000-0ff5d000 rwxp 000a3000 fd:01 3211 /lib/libm-2.5.so<br>
0ff6d000-0ff70000 r-xp 00000000 fd:01 3202 /lib/libdl-2.5.so<br>
0ff70000-0ff7f000 ---p 00003000 fd:01 3202 /lib/libdl-2.5.so<br>
0ff7f000-0ff80000 r--p 00002000 fd:01 3202 /lib/libdl-2.5.so<br>
0ff80000-0ff81000 rwxp 00003000 fd:01 3202 /lib/libdl-2.5.so<br>
0ff91000-0ffa6000 r-xp 00000000 fd:01 3246
/lib/libpthread-2.5.so<br>
0ffa6000-0ffb5000 ---p 00015000 fd:01 3246
/lib/libpthread-2.5.so<br>
0ffb5000-0ffb6000 r--p 00014000 fd:01 3246
/lib/libpthread-2.5.so<br>
0ffb6000-0ffb7000 rwxp 00015000 fd:01 3246
/lib/libpthread-2.5.so<br>
0ffb7000-0ffb9000 rwxp 0ffb7000 00:00 0 <br>
0ffc9000-</font><br>
<pre class="moz-signature" cols="72">--
Regards,
Manoj</pre>
</body>
</html>