[erlang-questions] Erlang C-nodes crashed randomly with double free, memory corruption malloc messege

Silver Surfer silver.surfertab@REDACTED
Tue Nov 15 20:32:52 CET 2016


Hi,
I have an application running on otp-19.0, where there is a single erlang
node and two c-nodes; several processes from erlang node continuously send
messages to the c-node servers. The c-node accepts a single connection and
process all the received messages (ERL_MSG-> ERL_REG_SEND, ERL_SEND) in
separate threads except ERL_TICK, ERL_ERROR etc.

So in the c-node main() a connection is accepted and all the messages are
received (erl_receive_msg), if the message is ERL_TICK, ERL_ERROR etc. they
are dealt appropriately by freeing the memory, else if the message is
ERL_MSG then a thread is created and the message is passed to the thread
where it is processed and a reply is send using erl_send; this approach of
handling message through thread is taken as some of the operation performed
by the c-node takes considerable amount of time which is more than the tick
time (is there a better way to do this?).

Now out of the two c-nodes one is crashing randomly (10 times in 24Hrs,
more or less); both the c-nodes follows same architecture, only the
operations they perform are different. In most of the times the c-node just
goes down without giving any error reason and in 2 or 3 cases it crashes
because of double free or memory corruption printer by malloc, the trace
back points to erl_receive_msg.

Another point observed is that, in the thread after erl_free_compound, when
we look at the allocated blocks using erl_eterm_statistics(allocated,
freed), it is 0 most of the times but sometimes it is non zero value, i.e.
9, 18, etc.

Any help is appreciated.

Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161116/9e025f54/attachment.htm>


More information about the erlang-questions mailing list