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 678914 - [PATCH] Segfault with typelib and library out-of-sync (interface vs class)
[PATCH] Segfault with typelib and library out-of-sync (interface vs class)
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
Git master
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-06-26 18:24 UTC by Dave Malcolm
Modified: 2012-07-11 06:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add error-checking for the case where _arg_cache_new fails (581 bytes, patch)
2012-06-26 18:24 UTC, Dave Malcolm
committed Details | Review

Description Dave Malcolm 2012-06-26 18:24:01 UTC
Created attachment 217318 [details] [review]
Add error-checking for the case where _arg_cache_new fails

I spent an hour or so with a colleague (dwalsh) debugging a segfault with pygobject, which turned out to be due to a typelib and its underlying library being out-of-sync.

I'm attaching a patch which converts the segfault into a traceback; in our case here's the traceback we received:
Traceback (most recent call last):
  • File "/bin/virt-sandbox-service", line 661 in <module>
    args.func(args)
  • File "/bin/virt-sandbox-service", line 514 in start
    container.start()
  • File "/bin/virt-sandbox-service", line 417 in start
    console = context.get_log_console()
  • File "/usr/lib64/python2.7/site-packages/gi/types.py", line 47 in function
    return info.invoke(*args, **kwargs)
  • File "/usr/lib64/python2.7/site-packages/gi/module.py", line 249 in __getattr__
    return getattr(self._introspection_module, name)
  • File "/usr/lib64/python2.7/site-packages/gi/module.py", line 185 in __getattr__
    wrapper = metaclass(name, bases, dict_)
  • File "/usr/lib64/python2.7/site-packages/gi/types.py", line 239 in __init__
    register_interface_info(cls.__info__.get_g_type())
TypeError: must be an interface

which immediately told us what the problem was, whereas previously it segfaulted trying to write though a NULL return_cache at:

     return_cache->is_skipped = g_callable_info_skip_return (callable_info);

within _args_cache_generate.
Comment 1 Paolo Borelli 2012-06-26 18:54:05 UTC
Review of attachment 217318 [details] [review]:

We should do that for all the other places where _arg_cache_new is used then

Or should we assert that arg_cache_new may never return NULL?  A quick look a _arg_cache_new seems indeed to indicate that the code may return NULL legally, but I am not very familiar with this code
Comment 2 Martin Pitt 2012-07-11 06:25:40 UTC
While this might not be complete, it looks correct to me and already helpful, so I pushed the patch. Thanks!