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 657244 - gnome-settings-daemon crashed with SIGSEGV in g_simple_async_result_complete()
gnome-settings-daemon crashed with SIGSEGV in g_simple_async_result_complete()
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: media-keys
3.1.x
Other Linux
: Normal critical
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2011-08-24 13:44 UTC by Pedro Villavicencio
Modified: 2012-03-09 14:51 UTC
See Also:
GNOME target: ---
GNOME version: 3.1/3.2


Attachments
Patch example (not complete) (1.48 KB, patch)
2011-09-28 12:58 UTC, David Henningsson
needs-work Details | Review

Description Pedro Villavicencio 2011-08-24 13:44:11 UTC
this report has been filed here:

https://bugs.launchpad.net/ubuntu/+source/gnome-settings-daemon/+bug/832603

".

Thread 1 (Thread 0xb77fc840 (LWP 1233))

  • #0 on_bus_gotten
    at gsd-media-keys-manager.c line 2048
  • #1 g_simple_async_result_complete
    at /build/buildd/glib2.0-2.29.16/./gio/gsimpleasyncresult.c line 749
  • #2 complete_in_idle_cb
    at /build/buildd/glib2.0-2.29.16/./gio/gsimpleasyncresult.c line 761
  • #3 g_idle_dispatch
    at /build/buildd/glib2.0-2.29.16/./glib/gmain.c line 4780
  • #4 g_main_dispatch
    at /build/buildd/glib2.0-2.29.16/./glib/gmain.c line 2439
  • #5 g_main_context_dispatch
    at /build/buildd/glib2.0-2.29.16/./glib/gmain.c line 3008
  • #6 g_main_context_iterate
    at /build/buildd/glib2.0-2.29.16/./glib/gmain.c line 3086
  • #7 g_main_loop_run
    at /build/buildd/glib2.0-2.29.16/./glib/gmain.c line 3294
  • #8 gtk_main
    at /build/buildd/gtk+3.0-3.1.12/./gtk/gtkmain.c line 1367
  • #9 main
    at main.c line 455

Comment 1 Bastien Nocera 2011-09-07 14:47:35 UTC
I can't actually see where it's crashing as this file doesn't match the upstream code. Let me know if you can actually provide the snippet of code that "line 2048" represents for that exact version of gnome-settings-daemon.

(Even better, get a backtrace with an unmodified 3.1.90, the media-keys plugin is heavily modified downstream)
Comment 2 David Henningsson 2011-09-28 12:58:00 UTC
I got this as well, and gave the resulting CoreDump an analysis.

In on_bus_gotten, manager->priv->introspection_data is NULL. This can happen if gsd_xrandr_manager_stop/gsd_media_keys_manager_stop/etc is called between register_manager and on_bus_gotten.

As I'm not a gnome expert, please review the attached patch before applying - and if you think it makes sense, extend it to do media_keys_manager, power_manager, etc as well. It also adds an explicit ref/unref to make sure the manager is not a dangling pointer at this point, but I doubt this is needed.
Comment 3 David Henningsson 2011-09-28 12:58:50 UTC
Created attachment 197659 [details] [review]
Patch example (not complete)
Comment 4 Rodrigo Moya 2011-09-28 14:42:11 UTC
As I said on the Launchpad bug, your fix is just for the symptom, not the real problem, which seems to be that we have _stop being called when the dbus operation is still in progress. So, I think we either should use the _sync version of g_bus_get (or even better, share a GDBusConnection between all the plugins, as this crash happens in media-keys, xrandr and power plugins) or use a GCancellable on the g_bus_get call and g_cancellable_cancel it in _stop, although that would make the call to complete and the callback being called (but I guess we can just check if the cancellable is cancelled there). Richard, Bastien, what do you think?
Comment 5 Bastien Nocera 2011-09-28 14:53:15 UTC
GDBusConnection is already a singleton when returned from g_bus_get() or g_bus_get_sync().

Using a cancellable is fine by me, but I'd certainly like to see a patch before it's committed.
Comment 6 Tobias Mueller 2012-01-12 11:55:45 UTC
Setting to NEW as this is apparently an issue that needs to be fixed.
Comment 7 Bastien Nocera 2012-03-09 11:32:55 UTC
Should already have been fixed by:

commit ae303fb2b05265888f8b65ba2236782693369da7
Author: Matthias Clasen <mclasen@redhat.com>
Date:   Fri Jan 20 09:11:14 2012 -0500

    Media keys: Be more careful when shutting down
    
    The gtksettings instance is also initialized in an idle, so
    we must handle it still being NULL when we shut down.


commit 42f9427729d763e7fd62aec9e15b036531489682
Author: Matthias Clasen <mclasen@redhat.com>
Date:   Fri Jan 20 09:00:54 2012 -0500

    media-keys: Be more careful when finalizing
    
    The keys array is initalized in an idle, so if we go right back down
    because another instance of gsd is already running, we crash in
    finalize, trying to clear a nonexisting array.

Amongst others. Let us know if you can still reproduce on a recent 3.3 gnome-settings-daemon build.
Comment 8 Tobias Mueller 2012-03-09 14:51:42 UTC
I'm closing as FIXED then. Please reopen if this is still an issue besides the patches. Also feel free to set to VERIFIED once it's confirmed that the issue is resolved.