After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 578419 - Segfault with 2.16.1 version and pyg_type_add_interfaces
Segfault with 2.16.1 version and pyg_type_add_interfaces
Status: RESOLVED NOTGNOME
Product: pygobject
Classification: Bindings
Component: gobject
2.16.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2009-04-08 19:50 UTC by Julien Lavergne
Modified: 2009-04-10 14:17 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Julien Lavergne 2009-04-08 19:50:45 UTC
Hi,

I notice there is some segfault with the pygobject 2.16, using 2 different python projects :

Screenlets on Debian unstable : http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=519664

Gramps on Ubuntu Jaunty : https://bugs.launchpad.net/ubuntu/+source/pygobject/+bug/357740

Backtraces are included in this 2 reports, this is the one for Screenlets :
$ gdb python
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
(gdb) run /usr/share/screenlets/AppMenu/AppMenuScreenlet.py
Starting program: /usr/bin/python /usr/share/screenlets/AppMenu/AppMenuScreenlet.py
[Thread debugging using libthread_db enabled]
[New Thread 0x7f620ca6f6f0 (LWP 20177)]

Program received signal SIGSEGV, Segmentation fault.

Thread 140059095791344 (LWP 20177)

  • #0 PyType_IsSubtype
    at ../Objects/typeobject.c line 836
  • #1 pyg_type_add_interfaces
    at /tmp/buildd/pygobject-2.16.1/gobject/gobjectmodule.c line 1088
  • #2 pyg_type_register
    at /tmp/buildd/pygobject-2.16.1/gobject/gobjectmodule.c line 1237
  • #3 _wrap_pyg_type_register
    at /tmp/buildd/pygobject-2.16.1/gobject/gobjectmodule.c line 954
  • #4 PyEval_EvalFrameEx
    at ../Python/ceval.c line 3612
  • #5 PyEval_EvalFrameEx
    at ../Python/ceval.c line 3698
  • #6 PyEval_EvalCodeEx
    at ../Python/ceval.c line 2875
  • #7 function_call
    at ../Objects/funcobject.c line 517
  • #8 PyObject_Call
    at ../Objects/abstract.c line 1861
  • #9 instancemethod_call
    at ../Objects/classobject.c line 2519
  • #10 PyObject_Call
    at ../Objects/abstract.c line 1861
  • #11 slot_tp_init
    at ../Objects/typeobject.c line 4976
  • #12 type_call
    at ../Objects/typeobject.c line 436
  • #13 PyObject_CallFunctionObjArgs
    at ../Objects/abstract.c line 1861
  • #14 PyEval_EvalFrameEx
    at ../Python/ceval.c line 4134
  • #15 PyEval_EvalCodeEx
    at ../Python/ceval.c line 2875
  • #16 PyEval_EvalCode
    at ../Python/ceval.c line 514
  • #17 PyImport_ExecCodeModuleEx
    at ../Python/import.c line 675
  • #18 load_source_module
    at ../Python/import.c line 959
  • #19 load_package
    at ../Python/import.c line 1015
  • #20 import_submodule
    at ../Python/import.c line 2400
  • #21 load_next
    at ../Python/import.c line 2220
  • #22 import_module_level
    at ../Python/import.c line 2001
  • #23 PyImport_ImportModuleLevel
    at ../Python/import.c line 2072
  • #24 builtin___import__
    at ../Python/bltinmodule.c line 47
  • #25 PyObject_Call
    at ../Objects/abstract.c line 1861
  • #26 PyEval_CallObjectWithKeywords
    at ../Python/ceval.c line 3481
  • #27 PyEval_EvalFrameEx
    at ../Python/ceval.c line 2093
  • #28 PyEval_EvalCodeEx
    at ../Python/ceval.c line 2875
  • #29 PyEval_EvalCode
    at ../Python/ceval.c line 514
  • #30 PyRun_FileExFlags
    at ../Python/pythonrun.c line 1273
  • #31 PyRun_SimpleFileExFlags
    at ../Python/pythonrun.c line 879
  • #32 Py_Main
    at ../Modules/main.c line 532
  • #33 __libc_start_main
    from /lib/libc.so.6
  • #34 _start


My first thought is that there is a problem in pyg_type_add_interfaces, because the problem appear after the upgrade to 2.16.1 and because it's a new function introduced in 2.16.
The problem is not reproductible on all configuration, I was unable to reproduce it on Debian unstable.
Comment 1 Gustavo Carneiro 2009-04-10 13:42:44 UTC
I cannot reliably reproduce this except when running in valgrind.  The following code triggers it in valgrind:

----------
import gtk

class ManagedWindow:
    pass

class Assistant(gtk.Object, ManagedWindow):
    __gproperties__ = {}
----------

I think it must be a side effect of old-style classes.  Changing

-class ManagedWindow:
+class ManagedWindow(object):

Makes the problem go away.  I know, it's no excuse, but I am just saying, multiple inheritance plus old-style classes is just asking for trouble :)
Comment 2 Gustavo Carneiro 2009-04-10 14:17:21 UTC
As far as I can tell this is a Python/C bug.  PyGObject is doing everything by the book, and it is Python that is giving us corrupted base objects.  I debugged long and hard but was unable to fix a bug that just isn't there, nor was I able to figure out a workaround.

I suggest applications start using new-style classes for everything.  Old-style classes will disappear anyway in Python 3.x.