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 675141 - telepathy-WARNING **: tpf-persona-store.vala:950: A TpContact part of the ContactList is disposed
telepathy-WARNING **: tpf-persona-store.vala:950: A TpContact part of the Con...
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: Telepathy backend
git master
Other Linux
: Normal normal
: Unset
Assigned To: folks-maint
folks-maint
Depends on:
Blocks:
 
 
Reported: 2012-04-30 12:24 UTC by Guillaume Desmottes
Modified: 2012-05-09 09:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
TpAccount: ensure connection is set to NULL before it unref all its contacts (3.18 KB, patch)
2012-04-30 13:12 UTC, Xavier Claessens
none Details | Review
TpfPersonaStore::_load_cache(): use _add_persona() (946 bytes, patch)
2012-04-30 15:50 UTC, Xavier Claessens
accepted-commit_now Details | Review
TpfPersonaStore: Immediately call _reset() when disconnected (2.87 KB, patch)
2012-04-30 15:50 UTC, Xavier Claessens
accepted-commit_now Details | Review

Description Guillaume Desmottes 2012-04-30 12:24:17 UTC
With folks master:

- Start folks-inspect (or gnome-contacts) with at least one XMPP account online
- Turn this account offline

Output is flooded with:

(lt-folks-inspect:5696): telepathy-WARNING **: tpf-persona-store.vala:950: A TpContact part of the ContactList is disposed
Comment 1 Guillaume Desmottes 2012-04-30 12:30:45 UTC


  • #0 g_logv
    at gmessages.c line 758
  • #1 g_log
    at gmessages.c line 792
  • #2 _tpf_persona_store_contact_weak_notify_cb
    at /home/cassidy/gnome/folks/backends/telepathy/lib/tpf-persona-store.vala line 950
  • #3 __tpf_persona_store_contact_weak_notify_cb_gweak_notify
    at /home/cassidy/gnome/folks/backends/telepathy/lib/tpf-persona-store.vala line 397
  • #4 weak_refs_notify
    at gobject.c line 2464
  • #5 g_data_set_internal
    at gdataset.c line 417
  • #6 g_datalist_id_set_data_full
    at gdataset.c line 680
  • #7 g_object_real_dispose
    at gobject.c line 1012
  • #8 tp_contact_dispose
    at contact.c line 847
  • #9 g_object_unref
    at gobject.c line 2981
  • #10 g_hash_table_remove_all_nodes
    at ghash.c line 536
  • #11 g_hash_table_remove_all
    at ghash.c line 1345
  • #12 tp_connection_invalidated
    at connection.c line 1297
  • #13 ffi_call_unix64
    at ../src/x86/unix64.S line 75
  • #14 ffi_call
    at ../src/x86/ffi64.c line 486
  • #15 g_cclosure_marshal_generic
    at gclosure.c line 1454
  • #16 g_closure_invoke
    at gclosure.c line 777
  • #17 signal_emit_unlocked_R
    at gsignal.c line 3547
  • #18 g_signal_emit_valist
    at gsignal.c line 3296
  • #19 g_signal_emit
    at gsignal.c line 3352
  • #20 tp_proxy_emit_invalidated
    at proxy.c line 581
  • #21 tp_proxy_invalidate
    at proxy.c line 625
  • #22 tp_connection_status_changed_cb
    at connection.c line 1236
  • #23 _tp_cli_connection_invoke_callback_for_status_changed
    at _gen/tp-cli-connection-body.h line 295
  • #24 tp_proxy_signal_invocation_run
    at proxy-signals.c line 268
  • #25 g_idle_dispatch
    at gmain.c line 4657
  • #26 g_main_dispatch
    at gmain.c line 2539
  • #27 g_main_context_dispatch
    at gmain.c line 3075
  • #28 g_main_context_iterate
    at gmain.c line 3146
  • #29 g_main_loop_run
    at gmain.c line 3340
  • #30 folks_inspect_client_run_interactive
    at inspect.c line 1052
  • #31 folks_inspect_client_main
    at inspect.c line 440
  • #32 main
    at inspect.c line 488

Comment 2 Xavier Claessens 2012-04-30 13:12:16 UTC
Created attachment 213103 [details] [review]
TpAccount: ensure connection is set to NULL before it unref all its contacts

This is to let a chance to applications to properly remove all contacts
at once instead of getting weak notify on them.
Comment 3 Xavier Claessens 2012-04-30 13:23:50 UTC
With that tp-glib patch, TpfPersonaStore::_notify_connection_cb() is called before all TpContact gets weak notified. But now the problem is the async _store_cache() that keeps personas.
Comment 4 Xavier Claessens 2012-04-30 15:50:53 UTC
Created attachment 213115 [details] [review]
TpfPersonaStore::_load_cache(): use _add_persona()
Comment 5 Xavier Claessens 2012-04-30 15:50:55 UTC
Created attachment 213116 [details] [review]
TpfPersonaStore: Immediately call _reset() when disconnected

Otherwise we get weak-notify for each TpContact when TpConnection
unref them.
Comment 6 Philip Withnall 2012-04-30 23:09:39 UTC
Review of attachment 213115 [details] [review]:

Nice cleanup.
Comment 7 Philip Withnall 2012-04-30 23:16:29 UTC
Review of attachment 213116 [details] [review]:

I’m not sure I understand what’s going on in this change. _load_cache() already calls _reset(), so this is just moving the _reset() call earlier. What’s the timeline of refs/unrefs on TpContacts which causes us to get weak-notifies without this patch, and how does this patch change it?
Comment 8 Xavier Claessens 2012-05-03 08:52:14 UTC
What happens when connection goes offline now:

1) TpConnection's TpProxy parent class emits "invalidated" signals.
2) TpConnection catch that signal first and unref all its TpContact.
3) folks get _contact_weak_notify_cb() for each contact, warn, and emits personas-changed for each contact one by one.
4) folks get _notify_connection_cb() to tell connection becomes NULL, but it's too late, folks already dropped all contacts.

What happens with patched tp-glib's with attachment #213103 [details]:

1) TpConnection's TpProxy parent class emits "invalidated" signals.
2) TpAccount catch that signal first and emits "notify::connection" to tell connection becomes NULL.
3) folks get _notify_connection_cb() and starts storing roster to cache asyncronously.
4) TpConnection catch the "invalidated" signal emitted in 1 and unref all its TpContact
5) folks get _contact_weak_notify_cb() for each contact, warn, and emits personas-changed for each contact one by one.

What happens with tp-glib patched AND folks patched with attachment # 213116 [details]:
1) TpConnection's TpProxy parent class emits "invalidated" signals.
2) TpAccount catch that signal first and emits "notify::connection" to tell connection becomes NULL.
3) folks get _notify_connection_cb() and calls immediately _reset() which weak_unref() all contacts, then start storing the cache asyncronously.
4) TpConnection catch the "invalidated" signal emitted in 1 and unref all its TpContact, nothing happens because folks does not have weak notify cb on them anymore.
5) folks finishes to store the cache, load it (yes, suboptimal that store and load what we stored...) and emits only one personas-changed with all previous personas removed and all from cache added.
Comment 9 Philip Withnall 2012-05-03 22:05:18 UTC
Review of attachment 213116 [details] [review]:

OK, that makes a lot more sense now; thanks. :-)

Please commit once making the changes below.

::: backends/telepathy/lib/tpf-persona-store.vala
@@ +626,3 @@
             {
+              var old_personas = this._persona_set;
+              this._reset ();

Probably a good idea to add a reference to this bug report here, so we don’t break this again in future.

@@ +793,3 @@
    * view of personas from the cache.
    */
+  private async void _load_cache (HashSet<Persona>? old_personas = null)

Might be useful to add a comment stating that the old_personas will be notified as removed using _emit_personas_changed().

@@ +824,3 @@
+        {
+          old_personas = this._persona_set;
+        }

I’d say it’s a bit cleaner to make the old_personas parameter mandatory, and remove this code. Just change the other caller of this._load_cache() to pass this._persona_set in explicitly.
Comment 10 Xavier Claessens 2012-05-09 09:56:24 UTC
both patches applied. Thanks.