Re: Segfault

From: Date: Sun, 17 Feb 2002 00:15:41 +0000
Subject: Re: Segfault
References: 1  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-355@lists.php.net to get a copy of this message
Andrei Zmievski wrote:
Privet Andrei,
http://anight.org/files/same-game.tar.bz2 i think that reproducing error whould be easier on a slower hardware, beacuse this is mainly screen refresh issue. i have duron 800 & geforce-256, and it takes < 1 minute to repeat error. today i found another method: not to moving window self, but moving any other window over. oh, i forget: i use gdk-pixbuf v0.11.0
I have downloaded your script, ran it and quickly moved the window around for 40 seconds or so -- no problems at all. I have Celeron 533Mhz with Voodoo 3 card. Moving other windows over it was fine too. This was using the CVS version of PHP-GTK which has not really changed since 0.5.0 release. It would be great if you could isolate this problem in a more easily reproducible environment. Thanks, -Andrei * Think digital, act analog. *
Morning, sir i have continued investigations. first, i have recompiled glib & gtk to include debug info (-g3) into shared libraries. i played with my script a whole day, and got three different types of backtraces: /* this one is caused by (timer event ?) */ Program received signal SIGSEGV, Segmentation fault. 0x00000005 in ?? () (gdb) bt #0 0x00000005 in ?? () #1 0x080ebfb8 in get_overloaded_property (T=0xbfffd13c) at ./zend_execute.c:926 #2 0x080f2779 in _get_zval_ptr (node=0x843bc64, Ts=0xbfffc994, should_free=0x813cbfc)
    at ./zend_execute.c:91
#3 0x080efd11 in execute (op_array=0x843a2f0) at ./zend_execute.c:1757 #4 0x080ef47d in execute (op_array=0x8166f58) at ./zend_execute.c:1630 #5 0x080af064 in call_user_function_ex (function_table=0x813cdd8, object_pp=0x0,
    function_name=0x8dc135c, retval_ptr_ptr=0xbfffdb34, param_count=0, params=0x8456d94,
    no_separation=0, symbol_table=0x0) at zend_execute_API.c:517
#6  0x402b88e9 in php_gtk_handler_marshal (a=0x0, data=0x8dc2ef4, nargs=0, args=0xbfffdb78)
    at php_gtk_object.c:273
#7 0x40927ca1 in gtk_invoke_idle_timeout (data=0x8655e10) at gtkmain.c:1244 #8 0x40a0ec23 in g_timeout_dispatch (source_data=0x8cab358, dispatch_time=0xbfffdc74,
    user_data=0x8655e10) at gmain.c:1302
#9 0x40a0dc46 in g_main_dispatch (dispatch_time=0xbfffdc74) at gmain.c:656 #10 0x40a0e273 in g_main_iterate (block=1, dispatch=1) at gmain.c:877 #11 0x40a0e43c in g_main_run (loop=0x8459808) at gmain.c:935 #12 0x4092696c in gtk_main () at gtkmain.c:524 #13 0x4025ed12 in zif_gtk_main (ht=0, return_value=0x851935c, this_ptr=0x0, return_value_used=0)
    at gen_gtk.c:885
#14 0x080ef27f in execute (op_array=0x8429a28) at ./zend_execute.c:1590 #15 0x080ef47d in execute (op_array=0x8176df4) at ./zend_execute.c:1630 #16 0x080b0c9e in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:814 #17 0x0805fbf6 in php_execute_script (primary_file=0xbffff418) at main.c:1307 #18 0x0805b0ac in main (argc=3, argv=0xbffff494) at cgi_main.c:738 #19 0x400ce7ee in __libc_start_main () from /lib/libc.so.6 /* this one is caused by (mouse clicking on drawingarea object ?) */ Program received signal SIGSEGV, Segmentation fault. 0x00000005 in ?? () (gdb) bt #0 0x00000005 in ?? () #1 0x080ebfb8 in get_overloaded_property (T=0xbfffb6e8) at ./zend_execute.c:926 #2 0x080f2779 in _get_zval_ptr (node=0x84312d8, Ts=0xbfff9f64, should_free=0x813cbfc)
    at ./zend_execute.c:91
#3 0x080efd11 in execute (op_array=0x84296b8) at ./zend_execute.c:1757 #4 0x080ef47d in execute (op_array=0x843a470) at ./zend_execute.c:1630 #5 0x080ef47d in execute (op_array=0x843f058) at ./zend_execute.c:1630 #6 0x080ef47d in execute (op_array=0x842cf10) at ./zend_execute.c:1630 #7 0x080af064 in call_user_function_ex (function_table=0x813cdd8, object_pp=0x0,
    function_name=0x843f88c, retval_ptr_ptr=0xbfffd778, param_count=2, params=0x842c4bc,
    no_separation=0, symbol_table=0x0) at zend_execute_API.c:517
#8  0x402b8778 in php_gtk_callback_marshal (o=0x844e930, data=0x843f78c, nargs=1,
    args=0xbfffd87c) at php_gtk_object.c:235
#9  0x4095a4c4 in gtk_handlers_run (handlers=0x844cc00, signal=0xbfffd828, object=0x844e930,
    params=0xbfffd87c, after=0) at gtksignal.c:1906
#10 0x409598cf in gtk_signal_real_emit (object=0x844e930, signal_id=21, params=0xbfffd87c)
    at gtksignal.c:1477
#11 0x40957837 in gtk_signal_emit (object=0x844e930, signal_id=21) at gtksignal.c:552
#12 0x4099081c in gtk_widget_event (widget=0x844e930, event=0x85e378c) at gtkwidget.c:2864
#13 0x40928065 in gtk_propagate_event (widget=0x844e930, event=0x85e378c) at gtkmain.c:1378
#14 0x409270af in gtk_main_do_event (event=0x85e378c) at gtkmain.c:818 #15 0x409dbed4 in gdk_event_dispatch (source_data=0x0, current_time=0xbfffdc74, user_data=0x0)
    at gdkevents.c:2143
#16 0x40a0dc46 in g_main_dispatch (dispatch_time=0xbfffdc74) at gmain.c:656 #17 0x40a0e273 in g_main_iterate (block=1, dispatch=1) at gmain.c:877 #18 0x40a0e43c in g_main_run (loop=0x845a1a0) at gmain.c:935 #19 0x4092696c in gtk_main () at gtkmain.c:524 #20 0x4025ed12 in zif_gtk_main (ht=0, return_value=0x8519cf4, this_ptr=0x0, return_value_used=0)
    at gen_gtk.c:885
#21 0x080ef27f in execute (op_array=0x842a3d0) at ./zend_execute.c:1590 #22 0x080ef47d in execute (op_array=0x8176df4) at ./zend_execute.c:1630 #23 0x080b0c9e in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:814 #24 0x0805fbf6 in php_execute_script (primary_file=0xbffff418) at main.c:1307 #25 0x0805b0ac in main (argc=3, argv=0xbffff494) at cgi_main.c:738 #26 0x400ce7ee in __libc_start_main () from /lib/libc.so.6 /* and this one is the same as from my previous postings */ Program received signal SIGSEGV, Segmentation fault. 0x00000005 in ?? () (gdb) bt #0 0x00000005 in ?? () #1 0x080ebfb8 in get_overloaded_property (T=0xbfffd1d8) at ./zend_execute.c:926 #2 0x080f2779 in _get_zval_ptr (node=0x8430940, Ts=0xbfffba54, should_free=0x813cbfc)
    at ./zend_execute.c:91
#3 0x080efd11 in execute (op_array=0x8428d20) at ./zend_execute.c:1757 #4 0x080af064 in call_user_function_ex (function_table=0x813cdd8, object_pp=0x0,
    function_name=0x84576f4, retval_ptr_ptr=0xbfffd7a8, param_count=2, params=0x842ab04,
    no_separation=0, symbol_table=0x0) at zend_execute_API.c:517
#5  0x402b8778 in php_gtk_callback_marshal (o=0x844df98, data=0x84577cc, nargs=1,
    args=0xbfffd8ac) at php_gtk_object.c:235
#6  0x4095a4c4 in gtk_handlers_run (handlers=0x844c1e8, signal=0xbfffd858, object=0x844df98,
    params=0xbfffd8ac, after=0) at gtksignal.c:1906
#7  0x409598cf in gtk_signal_real_emit (object=0x844df98, signal_id=26, params=0xbfffd8ac)
    at gtksignal.c:1477
#8  0x40957837 in gtk_signal_emit (object=0x844df98, signal_id=26) at gtksignal.c:552
#9  0x4099081c in gtk_widget_event (widget=0x844df98, event=0x85e2d98) at gtkwidget.c:2864
#10 0x4092714b in gtk_main_do_event (event=0x85e2d98) at gtkmain.c:834 #11 0x409dbed4 in gdk_event_dispatch (source_data=0x0, current_time=0xbfffdc74, user_data=0x0)
    at gdkevents.c:2143
#12 0x40a0dc46 in g_main_dispatch (dispatch_time=0xbfffdc74) at gmain.c:656 #13 0x40a0e273 in g_main_iterate (block=1, dispatch=1) at gmain.c:877 #14 0x40a0e43c in g_main_run (loop=0x8459808) at gmain.c:935 #15 0x4092696c in gtk_main () at gtkmain.c:524 #16 0x4025ed12 in zif_gtk_main (ht=0, return_value=0x851935c, this_ptr=0x0, return_value_used=0)
    at gen_gtk.c:885
#17 0x080ef27f in execute (op_array=0x8429a28) at ./zend_execute.c:1590 #18 0x080ef47d in execute (op_array=0x8176df4) at ./zend_execute.c:1630 #19 0x080b0c9e in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:814 #20 0x0805fbf6 in php_execute_script (primary_file=0xbffff418) at main.c:1307 #21 0x0805b0ac in main (argc=3, argv=0xbffff494) at cgi_main.c:738 #22 0x400ce7ee in __libc_start_main () from /lib/libc.so.6 sometimes i saw these errors and warnings (instead of segfault) all where refered to last line of these code blocks:
    $SpritesArray->render_to_drawable($widget->window,
        $widget->style->fg_gc[GTK_STATE_NORMAL],
        $sp_x, $sp_y,
        $px, $py,
        $bx, $by,
        GDK_RGB_DITHER_NORMAL,
        $sp_x, $sp_y); /*       Fatal: Underlying object missing      OR
                                Fatal: Underlying object missing or of invalid type
*/ and
    gdk::draw_rectangle($widget->window,
        $widget->style->black_gc,
        TRUE,
        $px, $py,
        $bx, $by); /*   Fatal: Underlying object missing             OR
                        Fatal: Underlying object missing or of invalid type              OR
                        Warning:  draw_rectangle() expects argument 2 to be GdkGC, unknown given
*/ finally, i tried to patch zend sources, and got "BUG!" instead of segfault: diff -u6 zend_llist.c.orig zend_llist.c --- zend_llist.c.orig.orMon Dec 17 08:22:24 2001
+++ zend_llist.c        Sun Feb 17 02:07:46 2002
@@ -105,12 +105,16 @@ ZEND_API void zend_llist_destroy(zend_llist *l) {
        zend_llist_element *current=l->head, *next;
        while (current) {
                next = current->next;
+               if (l->dtor == (void *)5) {
+                       printf("BUG!\n");
+                       exit(0);
+               }
                if (l->dtor) {
                        l->dtor(current->data);
                }
                pefree(current, l->persistent);
                current = next;
        }
i have reinstalled php-4.1.1 and php-gtk-0.5.0 from scratch several times. i have tried this on 2 different computers (suse 7.1 & suse 7.3) and the result was as described above. as i'm newbie with zend api, have no idea where should i dig to. hope you will find this info useful. regards, Andrei Nigmatulin

« previous php.gtk.dev (#355) next »