[erlang-questions] Segfault in NIF call

fredrik@REDACTED fredrik@REDACTED
Mon Apr 29 08:42:07 CEST 2013

Hello folks,

I'm having difficulties locating the cause of a segfault I'm getting when 
running tests with a NIF implementation I have.

Anything that would shed light on what's wrong is appreciated.

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.

> strings -a 
GCC|sort -u
GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

> USE_GDB=1 rebar eunit
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2aaaef381700 (LWP 19162)]
unlink_free_block (allctr=0x85f240, block=0x0, flags=0) at 
458    Uint sz = MBC_FBLK_SZ(&blk->block_head);
(gdb) backtrace
#0  unlink_free_block (allctr=0x85f240, block=0x0, flags=0) at 
#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
#2  0x000000000043b6da in mbc_alloc_block (alcu_flgsp=<synthetic pointer>, 
blk_szp=<synthetic pointer>, size=<optimized out>, allctr=0x85f240) at 
#3  mbc_alloc (allctr=0x85f240, size=<optimized out>) at 
#4  0x0000000000440d7b in do_erts_alcu_alloc (size=32, extra=0x85f240, 
type=148) at beam/erl_alloc_util.c:3530
#5  erts_alcu_alloc_thr_pref (type=148, extra=<optimized out>, 
size=<optimized out>) at beam/erl_alloc_util.c:3607
#6  0x0000000000490595 in erts_alloc (size=32, type=18967) at 
#7  new_message_buffer (size=0) at beam/erl_message.c:72
#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
#9  erts_send_message (sender=0x2aaaac9cd118, receiver=0x2aaaac9ccac8, 
receiver_locks=0x2aaaef380cb0, message=513931, flags=<optimized out>) at 
#10 0x0000000000476350 in do_send (p=0x2aaaac9cd118, to=550027, msg=513931, 
suspend=1, refp=<optimized out>) at beam/bif.c:2025
#11 0x0000000000476bf0 in erl_send (p=0x2aaaac9cd118, to=550027, 
msg=513931) at beam/bif.c:2138
#12 0x000000000052d1d8 in process_main () at beam/beam_emu.c:2558
#13 0x0000000000491463 in sched_thread_func (vesdp=0x2aaaac34de40) at 
#14 0x0000000000590440 in thr_wrapper (vtwd=0x7fffffffd7e0) at 
#15 0x00002aaaab3ffe9a in start_thread (arg=0x2aaaef381700) at 
#16 0x00002aaaab911cbd in clone () at 
#17 0x0000000000000000 in ?? ()

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130428/2900acf7/attachment.htm>

More information about the erlang-questions mailing list