Bug 51634

Summary: Possible ref count bug in mission-control wrt McdAccount
Product: Telepathy Reporter: Giovanni Campagna <scampa.giovanni>
Component: mission-controlAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED MOVED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Fix DBus paths not disappearing when the account is deleted

Description Giovanni Campagna 2012-07-01 16:33:38 UTC
While debugging a reproducible crash in mission-control-5 due to restarting the gnome-online-accounts daemon, I found that two accounts with the same name try to get on the same DBus name, which causes an assert in dbus-glib.
Since mcd_account_delete is correctly called when goa-daemon goes down (*), and since I suppose dbus-glib removes the DBus object registration when the associated GObject is finalized, there must be something keeping the dying McdAccount alive.
I tracked down to created_cb in mcd-account-manager.c. It creates the account through ->account_new, so it gets one reference. Then the account is added to the store in async_created_manager_cb, where the comment says it will be referenced (and in fact it is, by add_account).
Loading data, including the original ref to McdAccount, is said to be finalized through _mcd_account_load inside release_load_accounts_lock, but that only frees the containing structure, and not any object it refers to.

(*) I only saw that because I was debugging another crasher, due to invalid parameters passed to libgnome-keyring when removing a non-goa account.
Comment 1 Simon McVittie 2012-07-02 02:12:40 UTC
(In reply to comment #0)
> since I suppose dbus-glib removes the DBus object registration when the
> associated GObject is finalized

Yes, it does.

In addition to fixing the ref leak, it would be good to not rely on this behaviour, by calling tp_dbus_daemon_unregister_object() when the account is meant to fall off D-Bus.
Comment 2 Giovanni Campagna 2012-07-12 23:25:10 UTC
Created attachment 64155 [details] [review]
Fix DBus paths not disappearing when the account is deleted

Due to a reference leak in McdAccountManager, McdAccounts were
never unregistered from DBus, which caused a crash if a different
account was later registered with the same path (for example
after goa-daemon restarting). Fix the ref leak, and force disposal
of deleted accounts.
Comment 3 Giovanni Campagna 2012-08-14 00:09:55 UTC
I had to revert this, as it caused problems all around the stack and ultimately made mission-control crash.

It would be helpful if a Telepathy developer could look at this bug, and check if the ref leak was real or not.
Comment 4 GitLab Migration User 2019-12-03 20:12:13 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/telepathy/telepathy-mission-control/issues/61.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.