<div dir="ltr"><div style>Found one error (yay!) -- enif_open_resource_type should have NULL as the module argument (missed this one in the docs)</div><div style><br></div><div style>Running with cerl does not generate a segfault, nor any (extra) printouts</div>
<div style>Running with erl still generate segfault</div><div style><br></div><div style>Now I get either of the following (using erl), does it reveal what my error is?<br></div><div><br></div><div>> USE_GDB=1 rebar eunit<br>
</div><div style>[cut]</div><div>Program received signal SIGSEGV, Segmentation fault.<br></div><div><div>[Switching to Thread 0x2aaaad6c0700 (LWP 6384)]</div><div>0x000000000052b28a in process_main () at x86_64-unknown-linux-gnu/opt/smp/beam_hot.h:979</div>
<div>979<span class="" style="white-space:pre"> </span> MoveDeallocateReturn(xb(tmp_packed1&BEAM_LOOSE_MASK), r(0), Qb((tmp_packed1>>BEAM_LOOSE_SHIFT)));</div><div>(gdb) backtrace</div><div>#0 0x000000000052b28a in process_main () at x86_64-unknown-linux-gnu/opt/smp/beam_hot.h:979</div>
<div>#1 0x0000000000491463 in sched_thread_func (vesdp=0x2aaaac343ac0) at beam/erl_process.c:5632</div><div>#2 0x0000000000590440 in thr_wrapper (vtwd=0x7fffffffd850) at pthread/ethread.c:106</div><div>#3 0x00002aaaab3ffe9a in start_thread (arg=0x2aaaad6c0700) at pthread_create.c:308</div>
<div>#4 0x00002aaaab911cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112</div><div>#5 0x0000000000000000 in ?? ()</div></div><div><br></div><div style>or </div><div style><br></div><div style><div>Program received signal SIGSEGV, Segmentation fault.</div>
<div>[Switching to Thread 0x2aaaad6c0700 (LWP 6914)]</div><div>unlink_free_block (allctr=0x85e5c0, block=0x0, flags=0) at beam/erl_goodfit_alloc.c:458</div><div>458<span class="" style="white-space:pre"> </span> Uint sz = MBC_FBLK_SZ(&blk->block_head);</div>
<div>(gdb) backtrace</div><div>#0 unlink_free_block (allctr=0x85e5c0, block=0x0, flags=0) at beam/erl_goodfit_alloc.c:458</div><div>#1 0x0000000000444ee1 in get_free_block (allctr=0x85e5c0, size=<optimized out>, cand_blk=0x0, cand_size=0, flags=0) at beam/erl_goodfit_alloc.c:426</div>
<div>#2 0x000000000043b6da in mbc_alloc_block (alcu_flgsp=<synthetic pointer>, blk_szp=<synthetic pointer>, size=<optimized out>, allctr=0x85e5c0) at beam/erl_alloc_util.c:1309</div><div>#3 mbc_alloc (allctr=0x85e5c0, size=<optimized out>) at beam/erl_alloc_util.c:1451</div>
<div>#4 0x0000000000440d7b in do_erts_alcu_alloc (size=32, extra=0x85e5c0, type=148) at beam/erl_alloc_util.c:3530</div><div>#5 erts_alcu_alloc_thr_pref (type=148, extra=<optimized out>, size=<optimized out>) at beam/erl_alloc_util.c:3607</div>
<div>#6 0x0000000000490595 in erts_alloc (size=32, type=18967) at beam/erl_alloc.h:208</div><div>#7 new_message_buffer (size=0) at beam/erl_message.c:72</div><div>#8 erts_alloc_message_heap_state (statep=0x2aaaad6bfc4c, receiver_locks=0x2aaaad6bfcb0, receiver=0x2aaaac9c1db8, ohpp=<synthetic pointer>, bpp=<synthetic pointer>, size=0) at beam/global.h:1017</div>
<div>#9 erts_send_message (sender=0x2aaaac9c2470, receiver=0x2aaaac9c1db8, receiver_locks=0x2aaaad6bfcb0, message=564171, flags=<optimized out>) at beam/erl_message.c:1039</div><div>#10 0x0000000000476350 in do_send (p=0x2aaaac9c2470, to=793099, msg=564171, suspend=1, refp=<optimized out>) at beam/bif.c:2025</div>
<div>#11 0x0000000000476bf0 in erl_send (p=0x2aaaac9c2470, to=793099, msg=564171) at beam/bif.c:2138</div><div>#12 0x000000000052d1d8 in process_main () at beam/beam_emu.c:2558</div><div>#13 0x0000000000491463 in sched_thread_func (vesdp=0x2aaaac343ac0) at beam/erl_process.c:5632</div>
<div>#14 0x0000000000590440 in thr_wrapper (vtwd=0x7fffffffd850) at pthread/ethread.c:106</div><div>#15 0x00002aaaab3ffe9a in start_thread (arg=0x2aaaad6c0700) at pthread_create.c:308</div><div>#16 0x00002aaaab911cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112</div>
<div>#17 0x0000000000000000 in ?? ()</div><div><br></div></div><div><br></div><div style><div style>/Fredrik<br></div><div style><br></div><div style><br></div><div style><br></div><div style><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Apr 29, 2013 at 2:58 AM, Sverker Eriksson <span dir="ltr"><<a href="mailto:sverker.eriksson@ericsson.com" target="_blank">sverker.eriksson@ericsson.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Looks like some sort of memory corruption.<br>
<br>
Run on debug emulator and hope for a better (earlier) crash.<br>
<br>
# cd $ERL_TOP/erts/emulator<br>
# make TYPE=debug smp plain<br>
# $ERL_TOP/bin/cerl -debug<br>
<br>
/Sverker, Erlang/OTP Ericsson<br>
<br>
<a href="mailto:fredrik@machinezone.com" target="_blank">fredrik@machinezone.com</a> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hello folks,<br>
<br>
I'm having difficulties locating the cause of a segfault I'm getting when running tests with a NIF implementation I have.<br>
<br>
Anything that would shed light on what's wrong is appreciated.<br>
<br>
The backtrace does not seem to have anything to do with my NIF. The NIF:ed function is called from a few different processes, and it forwards the call to a worker thread which sends a message back to the caller process.<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
strings -a <br>
</blockquote>
../../otp/R16B/pre-5.10.1-mz-<u></u>0.2/lib/erlang/erts-5.10.1/<u></u>bin/beam.smp|fgrep GCC|sort -u<br>
GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
USE_GDB=1 rebar eunit<br>
<br>
</blockquote>
[cut]<br>
Program received signal SIGSEGV, Segmentation fault.<br>
[Switching to Thread 0x2aaaef381700 (LWP 19162)]<br>
unlink_free_block (allctr=0x85f240, block=0x0, flags=0) at beam/erl_goodfit_alloc.c:458<br>
458 Uint sz = MBC_FBLK_SZ(&blk->block_head);<br>
(gdb) backtrace<br>
#0 unlink_free_block (allctr=0x85f240, block=0x0, flags=0) at beam/erl_goodfit_alloc.c:458<br>
#1 0x0000000000444ee1 in get_free_block (allctr=0x85f240, size=<optimized out>, cand_blk=0x0, cand_size=0, flags=0) at beam/erl_goodfit_alloc.c:426<br>
#2 0x000000000043b6da in mbc_alloc_block (alcu_flgsp=<synthetic pointer>, blk_szp=<synthetic pointer>, size=<optimized out>, allctr=0x85f240) at beam/erl_alloc_util.c:1309<br>
#3 mbc_alloc (allctr=0x85f240, size=<optimized out>) at beam/erl_alloc_util.c:1451<br>
#4 0x0000000000440d7b in do_erts_alcu_alloc (size=32, extra=0x85f240, type=148) at beam/erl_alloc_util.c:3530<br>
#5 erts_alcu_alloc_thr_pref (type=148, extra=<optimized out>, size=<optimized out>) at beam/erl_alloc_util.c:3607<br>
#6 0x0000000000490595 in erts_alloc (size=32, type=18967) at beam/erl_alloc.h:208<br>
#7 new_message_buffer (size=0) at beam/erl_message.c:72<br>
#8 erts_alloc_message_heap_state (statep=0x2aaaef380c4c, receiver_locks=0x2aaaef380cb0, receiver=0x2aaaac9ccac8, ohpp=<synthetic pointer>, bpp=<synthetic pointer>, size=0) at beam/global.h:1017<br>
#9 erts_send_message (sender=0x2aaaac9cd118, receiver=0x2aaaac9ccac8, receiver_locks=0x2aaaef380cb0, message=513931, flags=<optimized out>) at beam/erl_message.c:1039<br>
#10 0x0000000000476350 in do_send (p=0x2aaaac9cd118, to=550027, msg=513931, suspend=1, refp=<optimized out>) at beam/bif.c:2025<br>
#11 0x0000000000476bf0 in erl_send (p=0x2aaaac9cd118, to=550027, msg=513931) at beam/bif.c:2138<br>
#12 0x000000000052d1d8 in process_main () at beam/beam_emu.c:2558<br>
#13 0x0000000000491463 in sched_thread_func (vesdp=0x2aaaac34de40) at beam/erl_process.c:5632<br>
#14 0x0000000000590440 in thr_wrapper (vtwd=0x7fffffffd7e0) at pthread/ethread.c:106<br>
#15 0x00002aaaab3ffe9a in start_thread (arg=0x2aaaef381700) at pthread_create.c:308<br>
#16 0x00002aaaab911cbd in clone () at ../sysdeps/unix/sysv/linux/<u></u>x86_64/clone.S:112<br>
#17 0x0000000000000000 in ?? ()<br>
(gdb) <br>
<br>
------------------------------<u></u>------------------------------<u></u>------------<br>
<br>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
<br>
</blockquote>
<br>
</blockquote></div><br></div></div>