A word on that pesky segmentation fault issue…

hi all, I just wanted to explain why so many of you are getting segmentation faults when you try to run the nautilus 3 client.

The pygtk world used to be quite simple and nice, with good documentation and well known best practices.  These were “static” gtk bindings that someone had to set up by hand (including me for nautilus-python).  These bindings were a pain in the butt to maintain over time but they worked pretty well and were predictable (good for coding against them).  However, a couple years ago the pygtk maintainers decided to abandon these bindings and start from scratch with “dynamic” bindings that would execute the original C code of the gtk library, which would have the effect of dramatically reducing the amount of hand-written binding code the pygtk developers would have to maintain.  These new dynamic bindings have been released for a while but are still pretty new to the world, but for the most part they work pretty well.  As you might be able to tell, the original Nautilus extension used the static pygtk bindings to run, and the new Nautilus 3 extension uses the new dynamic bindings to run.
Running Nautilus 2 with the static bindings works great, and running Nautilus 3 with the dynamic bindings works great as well, but problems start to occur when you try to run Nautilus (2 or 3) with both the static and dynamic bindings at the same time (this is possible).  Unfortunately this is what is happening for many of you right now.  Some extensions are written with the expectation that they can run with a mix of static and dynamic bindings, and if Nautilus 3 loads extensions that try to use the static and dynamic versions of a set of bindings at the same time, it will crash.

I’m not entirely sure what the solution to this is, though it will become less of a problem over time, as people switch completely over to the dynamic bindings.  However, for now, things will be a bit messy and you will have to decide which extensions you want to run.  Right now, the Nautilus 3 RabbitVCS extension uses dynamic bindings.  If you see the following error:

** (nautilus:2259): DEBUG: Syncdaemon not running, waiting for it to start in NameOwnerChanged
/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

Then it means you have another extension running that is trying to use the static bindings.  If you see this error (check in ~/.config/rabbitvcs/RabbitVCS.log) and your Nautilus isn’t able to run, first disable all nautilus-python extensions, then try to run RabbitVCS again.  Then one-by-one, enable your other extensions until Nautilus crashes again.  You should then report the issue either to myself or to the maintainer of said extension.

Hopefully this will resolve itself within a year or so, but until then it will be a somewhat bumpy ride.

Adam

12 responses to “A word on that pesky segmentation fault issue…”

  1. Evandro says:

    My log file is empty. I don’t get any error and the context menu don’t work.

    • Adam Plumb says:

      Can you run the command “NAUTILUS_PYTHON_DEBUG=misc nautilus -q” and tell me what you get?

      • Evandro says:

        Nothing is returned in this command.
        See below. Any idea?

        evandro@GFN-081:/usr/lib/nautilus/extensions-2.0$ NAUTILUS_PYTHON_DEBUG=misc nautilus -q
        evandro@GFN-081:/usr/lib/nautilus/extensions-2.0$

  2. Fredrik says:

    Hi

    I have tried posting on the mailing list, but for some reason it fails all the time.

    I have installed the latest RabbitVCS on three different computers running
    Ubuntu 11.10 and I get this issue on all on them. From what I can see I do
    not have any other Nautilus extensions installed on any of the computers. I
    have checked for extensions in /usr/share/nautilus-python/extensions and
    ~/.local/share/nautilus-python/extensions (I don’t even have the last
    folder).

    The ~/.config/rabbitvcs/RabbitVCS.log file is empty.

    Here are some output:

    NAUTILUS_PYTHON_DEBUG=misc nautilus
    ** (nautilus:4999): DEBUG: SyncDaemon already running, initializing SyncdaemonDaemon object
    nautilus_module_initialize: entered
    nautilus_python_load_dir: entered dirname=/usr/share/nautilus-python/extensions
    nautilus-python:g_module_open /usr/lib/libpython2.7.so.1.0
    nautilus-python:Py_Initialize
    nautilus-python:PySys_SetArgv
    nautilus-python:Sanitize the python search path
    nautilus-python:init_pygobject
    nautilus-python:import nautilus
    nautilus_python_load_file: entered filename=RabbitVCS
    /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

    Any ideas?

    Best regards,
    Fredrik

  3. d❤vid seaward says:

    If anyone knows how to track down nautilus-python extensions please answer at http://askubuntu.com/questions/77145/how-to-determine-all-python-nautilus-extensions-in-use – thanks!

  4. tmb says:

    I get a similar failure simply by doing this;

    >>> help()

    Welcome to Python 2.7! This is the online help utility.

    If this is your first time using Python, you should definitely check out
    the tutorial on the Internet at http://docs.python.org/tutorial/.

    Enter the name of any module, keyword, or topic to get help on writing
    Python programs and using Python modules. To quit this help utility and
    return to the interpreter, just type “quit”.

    To get a list of available modules, keywords, or topics, type “modules”,
    “keywords”, or “topics”. Each module also comes with a one-line summary
    of what it does; to list the modules whose summaries contain a given word
    such as “spam”, type “modules spam”.

    help> modules

    Please wait a moment while I gather a list of all available modules…

    /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: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0′ failed
    from gtk import _gtk

    ** (python:4655): CRITICAL **: pyg_register_boxed: assertion `boxed_type != 0′ failed
    /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: cannot register existing type `GdkDevice’
    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

  5. Hobs says:

    I get it in iPython as well. Some modules can be doctexted/searched successfully, but some cause a segmentation fault. So getting the error depends on which keyword you’re searching for and whether it occurs in the problematic modules.

    Python 2.7.2+ (default, Oct 4 2011, 20:03:08)
    Type “copyright”, “credits” or “license” for more information.

    IPython 0.10.2 — An enhanced Interactive Python.
    ? -> Introduction and overview of IPython’s features.
    %quickref -> Quick reference.
    help -> Python’s own help system.
    object? -> Details about ‘object’. ?object also works, ?? prints more.

    In [3]: help()

    Welcome to Python 2.7! This is the online help utility.

    If this is your first time using Python, you should definitely check out
    the tutorial on the Internet at http://docs.python.org/tutorial/.

    Enter the name of any module, keyword, or topic to get help on writing
    Python programs and using Python modules. To quit this help utility and
    return to the interpreter, just type “quit”.

    To get a list of available modules, keywords, or topics, type “modules”,
    “keywords”, or “topics”. Each module also comes with a one-line summary
    of what it does; to list the modules whose summaries contain a given word
    such as “spam”, type “modules spam”.

    help> modules word

    Here is a list of matching modules. Enter any module name to get more help.

    pwd – This module provides access to the Unix password database.
    spwd – This module provides access to the Unix shadow password database.
    dist-packages.IPython.completer – Word completion for IPython.

    ** (python:6640): CRITICAL **: pyg_register_boxed: assertion `boxed_type != 0′ failed
    Segmentation fault

  6. Most of the significant things on earth happen to be accomplished by people who have kept on trying when there have also been no hope in any respect.
    What is the subject of life – to have rich? All those fellows available getting rich could possibly be dancing around the real subject of life.

  7. As I web site possessor I believe the content matter here is
    rattling magnificent , appreciate it for your efforts.

    You should keep it up forever! Best of luck.

  8. […] one of these line end the error is gone! Better explanation of problems like this is found here: http://blog.rabbitvcs.org/archives/312. This entry was posted in Fedora, Gtk, Python by MartinsM. Bookmark the […]