Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed

Bug #923824 reported by Curtis Hovey
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Bazaar GTK+ Frontends
Invalid
High
Unassigned
bzr-dbus
Fix Released
High
Unassigned
bzr-dbus (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I see this error when I run gci from the command line or from gedit-developer-plugins:

/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
  import gobject._gobject

This is harmless from the command line, but when the code is embedded, the whole app becomes unstable and is likely to crash the next time any call to bzr-gtk is made.

I believe this happens when gir code is interacting with statically bound old gobject code, or there is an indirect import from old gobject. I suspect the import of dbus, and specifically dbus.glib is the issue. I think bzr-gtk should be using Gio.DBusProxy

Tags: gtk3 precise

Related branches

Curtis Hovey (sinzui)
tags: added: gtk3
Revision history for this message
Martin Pitt (pitti) wrote :

This is indeed due to loading a particular library both through GIR and through a static module. dbus can be mixed quite fine with Gtk, though; if you only use client-side d-bus (i. e. making calls), using Gio.DBusProxy will work fine, but if you want to export objects to the bus, you currently have to use the static "dbus" binding.

I advise to temporarily modify /usr/lib/python2.7/dist-packages/gobject/constants.py to say

raise ImportError("no static plz")

somewhere at the top, then you will get a proper backtrace and can easily identify the culprit.

Revision history for this message
Curtis Hovey (sinzui) wrote :

This TB shows that bzr-dbus is a gtk2 app. It needs upgrading to gtk3, or at least patched to work in both gtk2 and gtk3 operations.

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 919, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 1124, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 672, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 694, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 136, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/builtins.py", line 5259, in run
    local, keep_tags)
  File "/usr/lib/python2.7/dist-packages/bzrlib/builtins.py", line 5314, in _run
    revno=revno, local=local, keep_tags=keep_tags)
  File "/usr/lib/python2.7/dist-packages/bzrlib/uncommit.py", line 120, in uncommit
    branch.set_last_revision_info(new_revno, new_revision_id)
  File "/usr/lib/python2.7/dist-packages/bzrlib/decorators.py", line 218, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/branch.py", line 2583, in set_last_revision_info
    self._run_post_change_branch_tip_hooks(old_revno, old_revid)
  File "/usr/lib/python2.7/dist-packages/bzrlib/branch.py", line 1243, in _run_post_change_branch_tip_hooks
    hook(params)
  File "/usr/lib/python2.7/dist-packages/bzrlib/plugins/dbus/hook.py", line 36, in on_post_change_branch_tip
    activity = get_activity()
  File "/usr/lib/python2.7/dist-packages/bzrlib/plugins/dbus/hook.py", line 23, in get_activity
    import activity
  File "/usr/lib/python2.7/dist-packages/bzrlib/plugins/dbus/activity.py", line 29, in <module>
    import gobject
  File "/usr/lib/python2.7/dist-packages/gobject/__init__.py", line 47, in <module>
    from gobject.constants import *
  File "/usr/lib/python2.7/dist-packages/gobject/constants.py", line 23, in <module>

Revision history for this message
Curtis Hovey (sinzui) wrote :

dbus/activity.py is the only module that imports gtk libs. The module could be hacked to work with both gtk2 and gtk3. This hack solves the issues I see in precise and oneiric.

=== modified file 'activity.py'
--- activity.py 2008-02-13 00:29:52 +0000
+++ activity.py 2012-01-31 16:29:03 +0000
@@ -26,7 +26,10 @@
 import time

 import dbus.service
-import gobject
+try:
+ from gi.repository import GObject as gobject
+except ImportError:
+ import gobject

 from bzrlib.plugins.dbus import mapper
 from bzrlib.revision import NULL_REVISION
@@ -116,7 +119,6 @@
         # make a non-blocking call, which we can then ignore as we dont
         # care about responses: Apparently there is some dbus foo to help
         # make this not need the stub function
- import gobject
         mainloop = gobject.MainLoop()
         def handle_reply():
             # quit our loop.

Changed in bzr-dbus:
assignee: nobody → Curtis Hovey (sinzui)
status: New → In Progress
Jelmer Vernooij (jelmer)
Changed in bzr-dbus:
status: In Progress → Fix Committed
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bzr-dbus - 0.1~bzr52-1

---------------
bzr-dbus (0.1~bzr52-1) unstable; urgency=low

  * Depend on python-bzrlib rather than bzr itself, and recommend bzr.
  * New upstream snapshot.
   + Fixes compatibility withy gtk3. LP: #923824

 -- Jelmer Vernooij <email address hidden> Wed, 01 Feb 2012 17:20:02 +0100

Changed in bzr-dbus (Ubuntu):
status: New → Fix Released
Curtis Hovey (sinzui)
Changed in bzr-gtk:
status: Triaged → Invalid
Curtis Hovey (sinzui)
Changed in bzr-dbus:
status: Fix Committed → Fix Released
Revision history for this message
Satya (satya-bangalore) wrote :

Am still facing this issue.

/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
  import gobject._gobject
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: specified class size for type `PyGtkGenericCellRenderer' is smaller than the parent type's `GtkCellRenderer' class size
  from gtk import _gtk
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: g_type_get_qdata: assertion `node != NULL' failed
  from gtk import _gtk
Segmentation fault (core dumped)

Revision history for this message
Satya (satya-bangalore) wrote :

BTW, I tried with the latest trunk which has the fix.

Using ubuntu 12.04 64 bit. Python 2.7

Curtis Hovey (sinzui)
Changed in bzr-dbus:
assignee: Curtis Hovey (sinzui) → nobody
Revision history for this message
Satya (satya-bangalore) wrote :

Please let me know if you need any other details to fix the segmenatation fault/core dump.

Revision history for this message
GuilhemBichot (guilhem-bichot) wrote :

Same for us MySQL devs:

$ bzr gcommit

Committing to: /home/sujatha/repo/bug_repo/Bug14324766_mysql-5.1/

modified mysys/mf_iocache2.c

modified sql/log.cc

/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed

  import gobject._gobject

/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: specified class size for type `PyGtkGenericCellRenderer' is smaller than the parent type's `GtkCellRenderer' class size

  from gtk import _gtk

/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: g_type_get_qdata: assertion `node != NULL' failed

  from gtk import _gtk

Segmentation fault (core dumped)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.