Project

General

Profile

Actions

Bug #5252

closed

Segmentation Fault

Added by chaitanyav (NagaChaitanya Vellanki) over 13 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
Backport:
[ruby-core:39204]

Description

I am running a rake task to query data from a oracle database using C extension, I am seeing segmentation fault happening randomly.

ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

I have tried running the rake task inside the gdb, I have obtained the stack trace using the gdb. Can anyone help me understand the stack trace?.

(gdb) run /usr/bin/rake cassandra:load_data SETTINGS_FILE=loader_files/68865463.yaml --trace
Starting program: ruby /usr/bin/rake cassandra:load_data SETTINGS_FILE=loader_files/68865463.yaml --trace
[Thread debugging using libthread_db enabled]
[New Thread 46912499556288 (LWP 30944)]
[New Thread 1073756512 (LWP 30947)]
** Invoke cassandra:load_data (first_time)
** Invoke environment (first_time)
** Execute environment
[New Thread 1074284896 (LWP 30948)]
** Execute cassandra:load_data
[New Thread 1082677600 (LWP 30949)]
[New Thread 1091070304 (LWP 30950)]
[Thread 1091070304 (LWP 30950) exited]
[New Thread 1099463008 (LWP 30951)]
"Finished pulling data"
[Thread 1099463008 (LWP 30951) exited]
[New Thread 1099463008 (LWP 30952)]
[Thread 1099463008 (LWP 30952) exited]
[New Thread 1099463008 (LWP 30995)]
[Thread 1099463008 (LWP 30995) exited]
[New Thread 1091070304 (LWP 30996)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912499556288 (LWP 30944)]
0x00002aaaaab1b272 in finalize_list (objspace=0x503740, p=0xc0bb358) at gc.c:1814
1814 slot->limit--;
(gdb) bt full
#0 0x00002aaaaab1b272 in finalize_list (objspace=0x503740, p=0xc0bb358) at gc.c:1814
slot = (struct heaps_slot *) 0x2aaab9213850
tmp = (RVALUE *) 0xc0bb358
#1 0x00002aaaaab1c6f4 in rb_gc_finalize_deferred () at gc.c:2621
No locals.
#2 0x00002aaaaac20395 in rb_threadptr_execute_interrupts_rec (th=0x5033c0, sched_depth=0) at thread.c:1305
wait_event__ = Variable "wait_event__" is not available.

(gdb) backtrace
#0 0x00002aaaaab1b272 in finalize_list (objspace=0x503740, p=0xc0bb358) at gc.c:1814
#1 0x00002aaaaab1c6f4 in rb_gc_finalize_deferred () at gc.c:2621
#2 0x00002aaaaac20395 in rb_threadptr_execute_interrupts_rec (th=0x5033c0, sched_depth=0) at thread.c:1305
#3 0x00002aaaaac11162 in vm_call_method (th=0x5033c0, cfp=0x2aaaadd34670, num=1, blockptr=0x1, flag=0, id=60584, me=0x17646e0, recv=198781640) at vm_insnhelper.c:670
#4 0x00002aaaaac1477d in vm_exec_core (th=0x5033c0, initial=Variable "initial" is not available.
) at insns.def:1006
#5 0x00002aaaaac192ba in vm_exec (th=0x5033c0) at vm.c:1147
#6 0x00002aaaaac19c9c in invoke_block_from_c (th=0x5033c0, block=0x24a6eb0, self=5653000, argc=Variable "argc" is not available.
) at vm.c:558
#7 0x00002aaaaac1a071 in rb_vm_invoke_proc (th=0x5033c0, proc=0x24a6eb0, self=5653000, argc=2, argv=0x2aaaadc35200, blockptr=0x0) at vm.c:604
#8 0x00002aaaaab11d0d in proc_call (argc=2, argv=0x2aaaadc35200, procval=Variable "procval" is not available.
) at proc.c:556
#9 0x00002aaaaac10f85 in vm_call_method (th=0x5033c0, cfp=0x2aaaadd34988, num=2, blockptr=0x1, flag=0, id=5912, me=0x5fc6d0, recv=35624360) at vm_insnhelper.c:402
#10 0x00002aaaaac1477d in vm_exec_core (th=0x5033c0, initial=Variable "initial" is not available.
) at insns.def:1006
#11 0x00002aaaaac192ba in vm_exec (th=0x5033c0) at vm.c:1147
#12 0x00002aaaaac19c9c in invoke_block_from_c (th=0x5033c0, block=0x2aaaadd34ab8, self=35415120, argc=Variable "argc" is not available.
) at vm.c:558
#13 0x00002aaaaac1a3f7 in rb_yield (val=35624360) at vm.c:588
#14 0x00002aaaaaadbb3b in rb_ary_each (ary=35414320) at array.c:1427
#15 0x00002aaaaac10f85 in vm_call_method (th=0x5033c0, cfp=0x2aaaadd34a90, num=0, blockptr=0x2aaaadd34ab9, flag=0, id=424, me=0x5b9630, recv=35414320) at vm_insnhelper.c:402
#16 0x00002aaaaac1477d in vm_exec_core (th=0x5033c0, initial=Variable "initial" is not available.
) at insns.def:1006
#17 0x00002aaaaac192ba in vm_exec (th=0x5033c0) at vm.c:1147
#18 0x00002aaaaac19c9c in invoke_block_from_c (th=0x5033c0, block=0x2aaaadd34dd0, self=9467640, argc=Variable "argc" is not available.
) at vm.c:558
#19 0x00002aaaaac1a3f7 in rb_yield (val=5558320) at vm.c:588
#20 0x00002aaaaaadbb3b in rb_ary_each (ary=9079920) at array.c:1427
#21 0x00002aaaaac10f85 in vm_call_method (th=0x5033c0, cfp=0x2aaaadd34da8, num=0, blockptr=0x2aaaadd34dd1, flag=0, id=424, me=0x5b9630, recv=9079920) at vm_insnhelper.c:402
#22 0x00002aaaaac1477d in vm_exec_core (th=0x5033c0, initial=Variable "initial" is not available.
) at insns.def:1006
#23 0x00002aaaaac192ba in vm_exec (th=0x5033c0) at vm.c:1147
#24 0x00002aaaaac19669 in rb_iseq_eval_main (iseqval=5468880) at vm.c:1388
#25 0x00002aaaaab0a8e2 in ruby_exec_internal (n=0x5372d0) at eval.c:214
#26 0x00002aaaaab0a909 in ruby_exec_node (n=0x5372d0) at eval.c:261
#27 0x00002aaaaab0cf3f in ruby_run_node (n=0x5372d0) at eval.c:254
#28 0x000000000040097f in main (argc=5, argv=0x7fffffffdc28) at main.c:35
(gdb) quit

Updated by antares (Michael Klishin) over 13 years ago

Are you using any C extensions or libraries that may depend on C extensions? This looks like a well-know type of problems with missing GC guard.

Updated by chaitanyav (NagaChaitanya Vellanki) over 13 years ago

I am using two C extensions, one is a proprietary one to query a oracle database and the other is thrift which is used by cassandra. Can you please explain more about the GC guard?.

Updated by antares (Michael Klishin) over 13 years ago

Then you should check your proprietary extension for potentially missing GC guard: http://timetobleed.com/the-broken-promises-of-mrireeyarv

Updated by chaitanyav (NagaChaitanya Vellanki) over 13 years ago

I will let the developers know about this issue. For now, i have added GC.start after each of the methods inside the rake task which pull around 100K+ rows of data each. I am not getting segmentation fault anymore.

begin
cloader_obj = CassandraLoader.new
cloader_obj.load_data1(settings_hash)
GC.start

cloader_obj = CassandraLoader.new
cloader_obj.load_data2(settings_hash)
GC.start

rescue LoaderException
...
end

Updated by chaitanyav (NagaChaitanya Vellanki) over 13 years ago

Actually the code is like this

begin
cloader_obj = CassandraLoader.new
cloader_obj.load_data1(settings_hash)
GC.start

rescue LoaderException
...
end

begin
cloader_obj = CassandraLoader.new
cloader_obj.load_data2(settings_hash)
GC.start

rescue LoaderException
...
end

Updated by marcandre (Marc-Andre Lafortune) almost 13 years ago

  • Status changed from Open to Closed

Closing this, as apparently due to faulty proprietary C extension.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0