[fxruby-users] FXTableItem.new segmentation fault

Tim Smith tsmith at tektone.net
Thu Sep 25 13:43:45 EDT 2008


I've had it crash with FXRuby 1.6.14 on XP, Vista, and Linux.  I've also
had it crash with ruby 1.8.7 on Linux, with the same failed assertion
(FXRuby.cpp:1472), and the message "object allocation during garbage
collection phase".  I'm including a tweaked version below which seems to
crash more reliably within the first few minutes.

 

I'm also including a backtrace below.  It appears that during the
initialization of an FXTableItem, FXRbRegisterRubyObj() was called to
associate the Ruby object with the Fox object in FXRuby_Objects.  But
while this was happening, garbage collection occurred, causing
FXRbTableItem::markfunc() to be called, which called getIcon(), which
led to a lookup in FXRuby_Objects for the Ruby object which was still in
the process of being inserted there.

 

Tim Smith

 

require 'fox16'; include Fox

 

start = Time.now

count = 0

items = []

while true

  10.times {|j|

    items[j] = []

    28125.times {|i|

      items[j][i] = FXTableItem.new ''

    }

  }

  count += 1

  puts "#{count}, after #{Time.now - start} seconds"

end

 

 

FXRuby.cpp:1472: FXASSERT(!NIL_P(obj)) failed.

 

Breakpoint 1, rb_exc_raise (mesg=0) at eval.c:4616

4616    in eval.c

(gdb) bt

#0  rb_exc_raise (mesg=0) at eval.c:4616

#1  0x0805fb07 in rb_method_missing (argc=1, argv=0xfeefcff0, obj=4) at
eval.c:5630

#2  0x0805c192 in rb_call0 (klass=4143832220, recv=4, id=3889,
oid=4277134704, argc=1,

    argv=0xfeefcff0, body=0xf6fdc130, flags=2) at eval.c:5702

#3  0x0805c70b in rb_call (klass=4143832220, recv=4, mid=3889, argc=1,
argv=0xfeefcff0,

    scope=1, self=6) at eval.c:6094

#4  0x0805cd4e in rb_funcall2 (recv=0, mid=3889, argc=1,
argv=0xfeefcff0) at ruby.h:679

#5  0x0806008a in method_missing (obj=4, id=8311054, argc=0, argv=0x0,

    call_status=-17832592) at eval.c:5671

#6  0x0805c744 in rb_call (klass=4143829940, recv=4, mid=32465, argc=0,
argv=0x0, scope=1,

    self=6) at eval.c:6090

#7  0x0805cfb6 in vafuncall (recv=4, mid=32465, n=0, ar=0xfeefd0f4) at
ruby.h:679

#8  0x0805d0d2 in rb_funcall (recv=4277134704, mid=0, n=0) at
eval.c:6188

#9  0xf6b274d7 in FXRbCallIconMethod (recv=0x9e511c0, func=32465) at
FXRuby.cpp:1473

#10 0xf6b02dff in FXRbTableItem::getIcon (this=0x9e511c0) at
impl.cpp:1011

#11 0xf6920945 in FXRbTableItem::markfunc (self=0x9e511c0) at
markfuncs.cpp:517

#12 0x0806b672 in gc_mark_children (ptr=4129486760, lev=1) at gc.c:945

#13 0x0806bbca in mark_locations_array (x=0xfeefd9fc, n=5357) at
gc.c:629

#14 0x0806be3e in garbage_collect () at gc.c:1368

#15 0x0806c7b2 in ruby_xmalloc (size=65708) at gc.c:103

#16 0x0806c96d in ruby_xcalloc (n=16427, size=65708) at gc.c:123

#17 0x080a9d35 in rehash (table=0x965ad78) at st.c:324

#18 0x080a9eb0 in st_insert (table=0x965ad78, key=166007232,
value=166007264) at st.c:293

#19 0xf6b23c74 in FXRbRegisterRubyObj (rubyObj=4129486760,
foxObj=0x9e511c0)

    at FXRuby.cpp:253

#20 0xf69b71c7 in _wrap_new_FXTableItem (argc=3, argv=0xfeefe630,
self=4129486760)

    at table_wrap.cpp:846

#21 0x0805c192 in rb_call0 (klass=4143645140, recv=4129486760, id=73137,
oid=4277134704,

    argc=3, argv=0xfeefe630, body=0xf6fafc34, flags=2) at eval.c:5702

#22 0x0805c70b in rb_call (klass=4143645140, recv=4129486760, mid=73137,
argc=3,

    argv=0xfeefe630, scope=1, self=4129486760) at eval.c:6094

#23 0x08058773 in rb_eval (self=4129486760, n=0x0) at ruby.h:679

#24 0x08061bac in block_pass (self=4129486760, node=0xf635360c) at
eval.c:8884

#25 0x08058d56 in rb_eval (self=4129486760, n=0x0) at eval.c:3189

#26 0x0805c06a in rb_call0 (klass=4143645140, recv=4129486760, id=2961,
oid=4277134704,

    argc=0, argv=0xfeeff8c4, body=0xf63546c4, flags=2) at eval.c:5998

#27 0x0805c70b in rb_call (klass=4143645140, recv=4129486760, mid=2961,
argc=1,

    argv=0xfeeff8c0, scope=1, self=6) at eval.c:6094

#28 0x0805ccfc in rb_funcall2 (recv=0, mid=2961, argc=1,
argv=0xfeeff8c0) at ruby.h:679

#29 0x0805cd9a in rb_obj_call_init (obj=4129486760, argc=1,
argv=0xfeeff8c0) at eval.c:7626

#30 0x0807f490 in rb_class_new_instance (argc=1, argv=0xfeeff8c0,
klass=4143645140)

    at object.c:1594

#31 0x0805c192 in rb_call0 (klass=4143832320, recv=4143645140, id=3353,
oid=4277134704,

    argc=1, argv=0xfeeff8c0, body=0xf6fdcacc, flags=0) at eval.c:5702

#32 0x0805c70b in rb_call (klass=4143832320, recv=4143645140, mid=3353,
argc=1,

    argv=0xfeeff8c0, scope=0, self=4143827360) at eval.c:6094

#33 0x08058773 in rb_eval (self=4143827360, n=0x0) at ruby.h:679

#34 0x08059eaa in rb_eval (self=4143827360, n=0x0) at eval.c:3450

#35 0x0805dfaf in rb_yield_0 (val=42379, self=4143827360, klass=0,
flags=-152037876,

    avalue=0) at eval.c:5021

#36 0x0805efca in rb_yield (val=4277134704) at eval.c:5105

#37 0x0807d64f in int_dotimes (num=56251) at numeric.c:2787

#38 0x0805c16e in rb_call0 (klass=4143813360, recv=56251, id=5473,
oid=4277134704, argc=0,

    argv=0x0, body=0xf6fd9228, flags=0) at eval.c:5702

#39 0x0805c70b in rb_call (klass=4143813360, recv=56251, mid=5473,
argc=0, argv=0x0,

    scope=0, self=4143827360) at eval.c:6094

#40 0x08058773 in rb_eval (self=4143827360, n=0x0) at ruby.h:679

#41 0x0805b3f7 in rb_eval (self=4143827360, n=0x0) at eval.c:3203

#42 0x0805dfaf in rb_yield_0 (val=3, self=4143827360, klass=0,
flags=-152037596, avalue=0)

    at eval.c:5021

#43 0x0805efca in rb_yield (val=4277134704) at eval.c:5105

#44 0x0807d64f in int_dotimes (num=21) at numeric.c:2787

#45 0x0805c16e in rb_call0 (klass=4143813360, recv=21, id=5473,
oid=4277134704, argc=0,

    argv=0x0, body=0xf6fd9228, flags=0) at eval.c:5702

#46 0x0805c70b in rb_call (klass=4143813360, recv=21, mid=5473, argc=0,
argv=0x0, scope=0,

    self=4143827360) at eval.c:6094

#47 0x08058773 in rb_eval (self=4143827360, n=0x0) at ruby.h:679

#48 0x0805b3f7 in rb_eval (self=4143827360, n=0x0) at eval.c:3203

#49 0x0805a152 in rb_eval (self=4143827360, n=0x0) at eval.c:3127

#50 0x0806369c in ruby_exec_internal () at eval.c:1634

#51 0x080636cc in ruby_exec () at eval.c:1654

#52 0x080645eb in ruby_run () at eval.c:1664

#53 0x08052888 in main (argc=2, argv=0xfef02e44, envp=0xfef02e50) at
main.c:48

________________________________

From: fxruby-users-bounces at rubyforge.org
[mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of Philippe Lang
Sent: Thursday, September 25, 2008 1:58 AM
To: fxruby-users at rubyforge.org
Subject: Re: [fxruby-users] FXTableItem.new segmentation fault

 

Maybe you should try with FXRuby 1.6.14?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20080925/c00c4b16/attachment-0001.html>


More information about the fxruby-users mailing list