Skip to content

Instantly share code, notes, and snippets.

@dstrelau
Created April 19, 2011 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstrelau/64904501e19b555408f8 to your computer and use it in GitHub Desktop.
Save dstrelau/64904501e19b555408f8 to your computer and use it in GitHub Desktop.
(gdb) bt
#0 0xb77af424 in __kernel_vsyscall ()
#1 0xb7510651 in raise () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7513a82 in abort () from /lib/tls/i686/cmov/libc.so.6
#3 0xb76e7fe2 in rb_bug (fmt=0xb778cfd1 "Segmentation fault") at error.c:213
#4 0xb775b626 in sigsegv (sig=11, ip=0x9e3450c, context=0x9e3458c) at signal.c:775
#5 <signal handler called>
#6 mark_locations_array (x=0xb190a000, n=263168) at gc.c:1301
#7 0xb76ea05a in thread_mark (th=0x9ed9cd0) at eval.c:10755
#8 0xb770cb9a in gc_mark_children (ptr=3075158040) at gc.c:1598
#9 0xb770ce8e in rb_gc_mark (ptr=3075158040) at gc.c:1394
#10 0xb770d075 in mark_locations_array (x=0xbfeb4e90, n=2560) at gc.c:1303
#11 0xb770d2e4 in rb_gc_mark_locations (top_frame=0xbfeb4db4) at gc.c:1313
#12 garbage_collect_0 (top_frame=0xbfeb4db4) at gc.c:2166
#13 0xb770e16f in garbage_collect () at gc.c:2246
#14 0xb770e285 in rb_newobj () at gc.c:1012
#15 0xb76d2aa7 in ary_alloc (klass=3075325400) at array.c:104
#16 0xb76d2b14 in ary_new (klass=2979045376, len=263168) at array.c:119
#17 0xb76d3455 in rb_ary_new4 (n=0, elts=0x0) at array.c:188
#18 0xb76eaf09 in call_cfunc (func=0xb76f2790 <rb_thread_initialize>, recv=3075158040, len=34, argc=0, argv=0x40400) at eval.c:5920
#19 0xb76f560c in rb_call0 (klass=3075340760, recv=3075158040, id=2961, oid=2961, argc=0, argv=0x0, body=0xb74df974, flags=0) at eval.c:6073
#20 0xb76f58f8 in rb_call (klass=3075340760, recv=3075158040, mid=2961, argc=0, argv=0x0, scope=1, self=6) at eval.c:6323
#21 0xb76f5c07 in rb_obj_call_init (obj=3075158040, argc=0, argv=0x0) at eval.c:7975
#22 0xb76f5c5d in rb_thread_s_new (argc=0, argv=0x0, klass=3075340760) at eval.c:13026
#23 0xb76eaef5 in call_cfunc (func=0xb76f5c20 <rb_thread_s_new>, recv=3075340760, len=34, argc=0, argv=0x40400) at eval.c:5923
#24 0xb76f560c in rb_call0 (klass=3075340740, recv=3075340760, id=3361, oid=3361, argc=0, argv=0x0, body=0xb74df99c, flags=0) at eval.c:6073
#25 0xb76f58f8 in rb_call (klass=3075340740, recv=3075340760, mid=3361, argc=0, argv=0x0, scope=0, self=3075278220) at eval.c:6323
#26 0xb76fe776 in eval_call (self=3075278220, node=0xb74d152c) at eval.c:3396
#27 0xb76fbd55 in eval_iter (self=3075278220, node=0xb74d139c) at eval.c:3215
#28 0xb7700317 in rb_yield_0 (val=63, self=3075278220, klass=0, flags=<value optimized out>, avalue=0) at eval.c:5254
#29 0xb7701949 in rb_yield (val=63) at eval.c:5330
#30 0xb76d7474 in rb_ary_collect (ary=3075270560) at array.c:1838
#31 0xb76eaedc in call_cfunc (func=0xb76d7400 <rb_ary_collect>, recv=3075270560, len=34, argc=0, argv=0x40400) at eval.c:5926
#32 0xb76f560c in rb_call0 (klass=3075325400, recv=3075270560, id=3785, oid=3785, argc=0, argv=0x0, body=0xb74db734, flags=0) at eval.c:6073
#33 0xb76f58f8 in rb_call (klass=3075325400, recv=3075270560, mid=3785, argc=0, argv=0x0, scope=0, self=3075278220) at eval.c:6323
#34 0xb76fe776 in eval_call (self=3075278220, node=0xb74d15f4) at eval.c:3396
#35 0xb76fbd55 in eval_iter (self=3075278220, node=0xb74d1360) at eval.c:3215
#36 0xb76fe695 in eval_call (self=3075278220, node=0xb74d134c) at eval.c:3390
#37 0xb76fbd55 in eval_iter (self=3075278220, node=0xb74d12c0) at eval.c:3215
#38 0xb76fc7f9 in rb_eval (self=3075278220, node=0xb74d1608) at eval.c:4125
#39 0xb7700317 in rb_yield_0 (val=6, self=3075278220, klass=0, flags=<value optimized out>, avalue=0) at eval.c:5254
#40 0xb7701949 in rb_yield (val=6) at eval.c:5330
#41 0xb76f12ef in rb_ensure (b_proc=0xb77018e0 <rb_yield>, data1=6, e_proc=0xb77a8f00 <rb_mutex_unlock>, data2=3075278080) at eval.c:5716
#42 0xb77a8876 in rb_mutex_synchronize (self=3075278080) at thread.c:590
#43 0xb76eaedc in call_cfunc (func=0xb77a8830 <rb_mutex_synchronize>, recv=3075278080, len=34, argc=0, argv=0x40400) at eval.c:5926
#44 0xb76f560c in rb_call0 (klass=3075279980, recv=3075278080, id=11073, oid=11073, argc=0, argv=0x0, body=0xb74d0b04, flags=0) at eval.c:6073
#45 0xb76f58f8 in rb_call (klass=3075279980, recv=3075278080, mid=11073, argc=0, argv=0x0, scope=0, self=3075278220) at eval.c:6323
#46 0xb76fe776 in eval_call (self=3075278220, node=0xb74d1658) at eval.c:3396
#47 0xb76fbd55 in eval_iter (self=3075278220, node=0xb74d1284) at eval.c:3215
#48 0xb76ff368 in eval_while (self=3075278220, node=0xb74d1248) at eval.c:3133
#49 0xb76f556e in rb_call0 (klass=3075280620, recv=3075278220, id=5409, oid=5409, argc=0, argv=0x0, body=0xb74d1748, flags=0) at eval.c:6226
#50 0xb76f58f8 in rb_call (klass=3075280620, recv=3075278220, mid=5409, argc=0, argv=0x0, scope=0, self=3075352920) at eval.c:6323
#51 0xb76fe776 in eval_call (self=3075352920, node=0xb74d10b8) at eval.c:3396
#52 0xb7703587 in ruby_exec_internal () at eval.c:1700
#53 0xb77035d2 in ruby_exec () at eval.c:1720
#54 0xb770360f in ruby_run () at eval.c:1730
#55 0x080486bd in main (argc=Cannot access memory at address 0x22
) at main.c:48
require 'thread'
class Bluepill
def initialize
@mutex = Mutex.new
end
def run
Signal.trap('TERM') { @running = false }
Signal.trap('INT') { @running = false }
@running = true
while @running
@mutex.synchronize do
threads = (1..100).to_a.collect {|i|
Thread.new {
Thread.current[:stuff] = `ps axo pid,ppid,pcpu,rss`.split("\n")[i]
}
}.each {|t| t.join }
end
end
end
end
Bluepill.new.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment