Subject: [ruby-ffi] Segfault when using threads |
From: patrick.hemmer@gmail.com |
Date: 10/26/13 12:15 AM |
To: ruby-ffi@googlegroups.com |
require 'corosync/cpg'
cpg = Corosync::CPG.new('mygroup')
#cpg.dispatch(0) # this line runs perfectly
Thread.new { cpg.dispatch(0) }.join # this line segfaults
test.rb:4:in `block in <main>'
/home/phemmer/git/ruby-corosync/lib/corosync/cpg.rb:145:in `dispatch'
/home/phemmer/git/ruby-corosync/lib/corosync/cpg.rb:145:in `cpg_dispatch'
[New Thread 0x7ffff7ff9700 (LWP 30441)]
[New Thread 0x7ffff7ecf700 (LWP 30442)]
[New Thread 0x7fffeef7b700 (LWP 30443)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeef7b700 (LWP 30443)]
0x00007fffefae4c86 in hdb_handle_get (instance=0x7fffeee78580, handle_in=7749363892505018368,
handle_database=0x7fffefce7060 <cpg_handle_t_db>) at ../include/corosync/hdb.h:110
110 ../include/corosync/hdb.h: No such file or directory.
(gdb) where
#0 0x00007fffefae4c86 in hdb_handle_get (instance=0x7fffeee78580, handle_in=7749363892505018368,
handle_database=0x7fffefce7060 <cpg_handle_t_db>) at ../include/corosync/hdb.h:110
#1 cpg_dispatch (handle=7749363892505018368, dispatch_types=CS_DISPATCH_ONE_NONBLOCKING)
at cpg.c:357
#2 0x00007fffefef1010 in ffi_call_unix64 () from /usr/lib64/libffi.so.6
#3 0x00007fffefef0a8a in ffi_call () from /usr/lib64/libffi.so.6
#4 0x00007ffff0101f3e in rbffi_CallFunction ()
from /home/phemmer/.gem/ruby/1.9.1/gems/ffi-1.9.0/lib/ffi_c.so
#5 0x00007ffff0105956 in custom_trampoline ()
from /home/phemmer/.gem/ruby/1.9.1/gems/ffi-1.9.0/lib/ffi_c.so
#6 0x00007ffff7af9898 in call_cfunc (func=0x7ffff7fee0d8, recv=9748160, len=-1, argc=2,
argv=0x7fffeef7c070) at vm_insnhelper.c:317
#7 0x00007ffff7afa1b6 in vm_call_cfunc (th=0x837840, reg_cfp=0x7fffef07beb0, num=2, recv=9748160,
blockptr=0x0, me=0x87c420) at vm_insnhelper.c:404
#8 0x00007ffff7afa893 in vm_call_method (th=0x837840, cfp=0x7fffef07beb0, num=2, blockptr=0x0,
flag=0, id=15088, me=0x87c420, recv=9748160) at vm_insnhelper.c:530
#9 0x00007ffff7b001ab in vm_exec_core (th=0x837840, initial=0) at insns.def:1018
#10 0x00007ffff7b0d5a5 in vm_exec (th=0x837840) at vm.c:1236
#11 0x00007ffff7b0beff in invoke_block_from_c (th=0x837840, block=0x607ad0, self=6711000, argc=0,
argv=0xa8e7e8, blockptr=0x0, cref=0x0) at vm.c:640
#12 0x00007ffff7b0c111 in rb_vm_invoke_proc (th=0x837840, proc=0x607ad0, self=6711000, argc=0,
argv=0xa8e7e8, blockptr=0x0) at vm.c:686
#13 0x00007ffff7b12eaa in thread_start_func_2 (th=0x837840, stack_start=0x7fffeef7c000)
at thread.c:466
#14 0x00007ffff7b11b88 in thread_start_func_1 (th_ptr=0x837840) at thread_pthread.c:657
#15 0x00007ffff73ba03a in start_thread () from /lib64/libpthread.so.0
#16 0x00007ffff76b740d in clone () from /lib64/libc.so.6