[Kde-bindings] crash testing a korundum application with rspec and ruby 1.8.7-p160

Richard Dale rdale at foton.es
Wed May 27 10:08:36 UTC 2009


On Friday 15 May 2009 05:02:38 pm Stefano Crocco wrote:
> On Sunday 10 May 2009, Stefano Crocco wrote:
> > |I'm using rspec to test my korundum4 application (with latest svn
> > | revision of both kde and korundum). I have a sets of tests which, until
> > | yesterday, worked correctly. Yesterday, I installed ruby 1.8.7-p160
> > | (before I used ruby-1.8.7- p72) and suddnely I got a number of crashes.
> > | Looking at the changelog for ruby-1.8.7-p72, I noticed two entries
> > | related to the function run_final mentioned in the stack traces I got
> > | from the crashes. Those entries are:
> > |
> > |* gc.c (run_final): frees zombies only
> > |* gc.c (run_final): calls free function
>
> ...
>
> > |I tried disabling the GC and indeed the tests stopped crashing.
> > |
> > |I must add that the application these tests refer to still works
> > | correctly. The crashes only happen in the tests.
>
> Unfortunately, the last statement turned out to be rather optimistic: it
> seems that random crashes happens also outside tests. This made me think
> that maybe the issue is not with my program but that the way qtruby deals
> with garbage collecting isn't completely compatible with the new ruby
> version. Do you think this is possible?
>
> I tried looking inside at the gc.c source and, according with the stack
> traces I get, it seems that the lines causing the crashes are these (in
> particular, the middle one):
>
>     if (BUILTIN_TYPE(obj) == T_DEFERRED && RDATA(obj)->dfree) {
> 	(*RDATA(obj)->dfree)(DATA_PTR(obj));
>     }
>
> These lines seem to be new in ruby 1.8.7-p160.
>
> The failing line in qtruby is line 373 ruby/qtruby/src/handlers.cpp, which
> contains a simple
>
> if (qobject->parent() != 0) {
>
> As I said in my previous message, I can't provide an example of code with
> this crash, because I can't begin to understand its reasons. The pieces of
> code which cause this look like a number of other pieces of code which
> instead work flawlessly. If you need me to test something, however, I'm
> ready to do that.
>
> By the way, since I kept having crashes at the C level even before this
> issue, I'd like to learn about the inner workings of smoke and qtruby, so
> that I can at least try to understand what's wrong in my code. Does anyone
> know whether there's some documentation about this (aside from the smoke
> example at http://techbase.kde.org/Development/Languages/Smoke)?
I went to the Ruby site to download the version you are using, but it wasn't 
there, only p71. So is it a stable version, or is it possible that this is 
some kind of bug in Ruby itself?

If the same instance is being freed twice maybe it would help to set the 'o-
>ptr' value to 0, even if that is  workround:

mardigras rdale 593% svn diff Qt.cpp
Index: Qt.cpp
===================================================================
--- Qt.cpp      (revision 966580)
+++ Qt.cpp      (working copy)
@@ -128,6 +128,7 @@
 void
 free_smokeruby_object(smokeruby_object * o)
 {
+    o->ptr = 0;
        xfree(o);
        return;
 }

-- Richard




More information about the Kde-bindings mailing list