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 683267 - [new roster] Warning when starting in non group mode
[new roster] Warning when starting in non group mode
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: general
git master
Other Linux
: Normal blocker
: Unset
Assigned To: Jeremy Whiting
folks-maint
: 683454 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-09-03 13:29 UTC by Guillaume Desmottes
Modified: 2012-09-10 07:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Added emit_notification parameter to _update (10.39 KB, patch)
2012-09-06 23:11 UTC, Jeremy Whiting
needs-work Details | Review
Added emit_notification parameter to _update methods (24.78 KB, patch)
2012-09-07 00:24 UTC, Jeremy Whiting
accepted-commit_now Details | Review

Description Guillaume Desmottes 2012-09-03 13:29:51 UTC
./tests/interactive/test-empathy-roster-model-aggregator


(lt-test-empathy-roster-model-aggregator:24017): GLib-WARNING **: Accessing a sequence while it is being sorted or searched is not allowed

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff3deb1e9 in g_logv (log_domain=0x7ffff3e71589 "GLib", log_level=G_LOG_LEVEL_WARNING, 
    format=0x7ffff3e71540 "Accessing a sequence while it is being sorted or searched is not allowed", args1=0x7fffffff8ee8) at gmessages.c:758
758		buf[i] = c + 'a' - 10;
(gdb) bt
  • #0 g_logv
    at gmessages.c line 758
  • #1 g_log
    at gmessages.c line 792
  • #2 check_seq_access
    at gsequence.c line 171
  • #3 g_sequence_sort
    at gsequence.c line 676
  • #4 egg_list_box_resort
    at egg-list-box.c line 554
  • #5 groups_changed_cb
    at empathy-roster-view.c line 956
  • #6 ffi_call_unix64
    at ../src/x86/unix64.S line 75
  • #7 ffi_call
    at ../src/x86/ffi64.c line 486
  • #8 g_cclosure_marshal_generic
    at gclosure.c line 1454
  • #9 g_closure_invoke
    at gclosure.c line 777
  • #10 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #11 g_signal_emit_valist
    at gsignal.c line 3300
  • #12 g_signal_emit
    at gsignal.c line 3356
  • #13 empathy_roster_model_fire_groups_changed
    at empathy-roster-model.c line 88
  • #14 individual_group_changed_cb
    at empathy-roster-model-aggregator.c line 95
  • #15 g_cclosure_user_marshal_VOID__STRING_BOOLEAN
    at /home/cassidy/gnome/folks/folks/group-details.vala line 32
  • #16 g_closure_invoke
    at gclosure.c line 777
  • #17 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #18 g_signal_emit_valist
    at gsignal.c line 3300
  • #19 g_signal_emit_by_name
    at gsignal.c line 3393
  • #20 _folks_individual_update_groups
    at /home/cassidy/gnome/folks/folks/individual.vala line 1463
  • #21 folks_individual_real_get_groups
    at /home/cassidy/gnome/folks/folks/individual.vala line 707
  • #22 folks_group_details_get_groups
    at /home/cassidy/gnome/folks/folks/group-details.vala line 128
  • #23 empathy_roster_model_aggregator_get_groups_for_individual
    at empathy-roster-model-aggregator.c line 403
  • #24 empathy_roster_model_get_groups_for_individual
    at empathy-roster-model.c line 136
  • #25 contact_in_top
    at empathy-roster-view.c line 562
  • #26 compare_roster_contacts_no_group
    at empathy-roster-view.c line 607
  • #27 compare_roster_contacts
    at empathy-roster-view.c line 661
  • #28 roster_view_sort
    at empathy-roster-view.c line 703
  • #29 do_sort
    at egg-list-box.c line 543
  • #30 iter_compare
    at gsequence.c line 231
  • #31 node_find_closest
    at gsequence.c line 1764
  • #32 node_insert_sorted
    at gsequence.c line 2002
  • #33 g_sequence_insert_sorted_iter
    at gsequence.c line 1027
  • #34 g_sequence_insert_sorted
    at gsequence.c line 717
  • #35 egg_list_box_real_add
    at egg-list-box.c line 1350
  • #36 g_cclosure_marshal_VOID__OBJECT
    at gmarshal.c line 1272
  • #37 g_type_class_meta_marshal
    at gclosure.c line 970
  • #38 g_closure_invoke
    at gclosure.c line 777
  • #39 signal_emit_unlocked_R
    at gsignal.c line 3481
  • #40 g_signal_emit_valist
    at gsignal.c line 3300
  • #41 g_signal_emit
    at gsignal.c line 3356
  • #42 gtk_container_add
    at gtkcontainer.c line 1520
  • #43 add_roster_contact
    at empathy-roster-view.c line 186
  • #44 add_to_group
    at empathy-roster-view.c line 338
  • #45 individual_added
    at empathy-roster-view.c line 364
  • #46 individual_added_cb
    at empathy-roster-view.c line 538
  • #47 g_cclosure_marshal_VOID__OBJECT
    at gmarshal.c line 1272
  • #48 g_closure_invoke
    at gclosure.c line 777
  • #49 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #50 g_signal_emit_valist
    at gsignal.c line 3300
  • #51 g_signal_emit
    at gsignal.c line 3356
  • #52 empathy_roster_model_fire_individual_added
    at empathy-roster-model.c line 72
  • #53 add_to_filtered_individuals
    at empathy-roster-model-aggregator.c line 109
  • #54 add_individual
    at empathy-roster-model-aggregator.c line 154
  • #55 aggregator_individuals_changed_cb
    at empathy-roster-model-aggregator.c line 201
  • #56 g_cclosure_user_marshal_VOID__OBJECT_OBJECT_STRING_OBJECT_ENUM
    at /home/cassidy/gnome/folks/folks/individual-aggregator.vala line 78
  • #57 g_closure_invoke
    at gclosure.c line 777
  • #58 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #59 g_signal_emit_valist
    at gsignal.c line 3300
  • #60 g_signal_emit_by_name
    at gsignal.c line 3393
  • #61 _folks_individual_aggregator_emit_individuals_changed
    at /home/cassidy/gnome/folks/folks/individual-aggregator.vala line 982
  • #62 _folks_individual_aggregator_personas_changed_cb
    at /home/cassidy/gnome/folks/folks/individual-aggregator.vala line 1504
  • #63 __folks_individual_aggregator_personas_changed_cb_folks_persona_store_personas_changed
    at /home/cassidy/gnome/folks/folks/individual-aggregator.vala line 808
  • #64 g_cclosure_user_marshal_VOID__OBJECT_OBJECT_STRING_OBJECT_ENUM
    at /home/cassidy/gnome/folks/folks/persona-store.vala line 316
  • #65 g_closure_invoke
    at gclosure.c line 777
  • #66 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #67 g_signal_emit_valist
    at gsignal.c line 3300
  • #68 g_signal_emit_by_name
    at gsignal.c line 3393
  • #69 _folks_persona_store_emit_personas_changed
    at /home/cassidy/gnome/folks/folks/persona-store.vala line 439
  • #70 _tpf_persona_store_contact_list_changed_cb
    at /home/cassidy/gnome/folks/backends/telepathy/lib/tpf-persona-store.vala line 1185
  • #71 _tpf_persona_store_contact_list_state_changed_cb
    at /home/cassidy/gnome/folks/backends/telepathy/lib/tpf-persona-store.vala line 1125
  • #72 _tpf_persona_store_notify_connection_cb_async_co
    at /home/cassidy/gnome/folks/backends/telepathy/lib/tpf-persona-store.vala line 815
  • #73 _tpf_persona_store_notify_connection_cb_async_ready
    at /home/cassidy/gnome/folks/backends/telepathy/lib/tpf-persona-store.vala line 721
  • #74 g_simple_async_result_complete
    at gsimpleasyncresult.c line 767
  • #75 connection_get_alias_flags_cb
    at tp-lowlevel.c line 52
  • #76 _tp_cli_connection_interface_aliasing_invoke_callback_get_alias_flags
    at _gen/tp-cli-connection-body.h line 3638
  • #77 tp_proxy_pending_call_idle_invoke
    at proxy-methods.c line 155
  • #78 g_idle_dispatch
    at gmain.c line 4777
  • #79 g_main_dispatch
    at gmain.c line 2691
  • #80 g_main_context_dispatch
    at gmain.c line 3195
  • #81 g_main_context_iterate
    at gmain.c line 3266
  • #82 g_main_loop_run
    at gmain.c line 3460
  • #83 gtk_main
    at gtkmain.c line 1162
  • #84 main
    at test-empathy-roster-model-aggregator.c line 161

Comment 1 Guillaume Desmottes 2012-09-03 14:19:18 UTC
This is a side effect of bug #682809 :
- A contact is added, Empathy creates a widget for it
- EggListBox asks to Empathy to sort the widget
- Empathy asks Folks for the contact's groups
- Folks sets the group and fire the "group-changed" signal
- Empathy asks to EggListBox to resort the widget

I'm not sure what's the best way to fix this. I guess EggListBox could be
more careful not trying to resort twice the same item?
Comment 2 Guillaume Desmottes 2012-09-03 14:21:23 UTC
Philip, Alexander: thoughts?
Comment 3 Philip Withnall 2012-09-04 23:17:48 UTC
(In reply to comment #1)
> I'm not sure what's the best way to fix this. I guess EggListBox could be
> more careful not trying to resort twice the same item?

That seems like the simplest and most robust solution.
Comment 4 Alexander Larsson 2012-09-05 09:59:06 UTC
Its not generally workable to have the sort comparison operation actually change the data in the container being sorted. Just ignoring the second call to sort will result in an incorrectly sorted state.

I don't think its ever right to reenter in this fashion inside a simple getter function. If you really want to read the item data incrementally like that it needs to be done in an idle, not by reentering.

Sorting is just one case of the sort of problems this reentrancy can cause. Any code that calls a getter during modification of internal state which is based on folks will break when the internal state is unexpectedly modified in the middle of an operation.
Comment 5 Guillaume Desmottes 2012-09-06 13:14:21 UTC
*** Bug 683454 has been marked as a duplicate of this bug. ***
Comment 6 Guillaume Desmottes 2012-09-06 13:17:57 UTC
I agree with Alexander, firing signals in a getter function isn't great. If anything, it should be fired in an idle.

Re-assigning to Folks.
Comment 7 Jeremy Whiting 2012-09-06 20:35:04 UTC
Philip,

One fix for this would be to not send the group changed signal when lazy loading groups, would that cause any issue that you can foresee?  Alternatively we could make groups not lazy load.  Either way we need a fix for this in order for 0.7.4 to be ready to release imo.
Comment 8 Philip Withnall 2012-09-06 22:15:29 UTC
(In reply to comment #7)
> Either way we need a fix for this in order
> for 0.7.4 to be ready to release imo.

Agreed. This should block the release.

> One fix for this would be to not send the group changed signal when lazy
> loading groups, would that cause any issue that you can foresee?

That shouldn’t cause any issues (it’s what we were doing before my branch was merged). As discussed on IRC, I suggest passing a second boolean to _update_groups() which specifies whether a notification may be emitted.
Comment 9 Jeremy Whiting 2012-09-06 23:11:06 UTC
Created attachment 223717 [details] [review]
Added emit_notification parameter to _update

This should fix the bug, I am able to sign in and out repeatedly without issue here (but I can do the same with master, so not quite sure if this fixes the issue tbh).
Comment 10 Philip Withnall 2012-09-06 23:38:49 UTC
Review of attachment 223717 [details] [review]:

Almost.

This also needs to be done in edsf-persona.vala and tpf-persona.vala as per http://git.gnome.org/browse/folks/commit/?id=57f84d50f5fcaf3bf821d368a7ff309bc2edb3d2 and http://git.gnome.org/browse/folks/commit/?id=eb75447e8eb6a95aad8f95ee19a2cd4a945fefa1.

::: folks/individual.vala
@@ +1440,3 @@
         {
           /* Notify and return. */
+          if (create_if_not_exist == false && emit_notification)

This isn’t right. If (create_if_not_exist == false) but (emit_notification == false) then the method won’t return immediately like it does without the patch.

@@ +1464,3 @@
        * changed — we can't be sure, but emitting is a safe over-estimate) and
        * return. */
+      if (this._groups == null && create_if_not_exist == false && emit_notification)

As above, this won’t return immediately if (create_if_not_exist == false && emit_notification == false).

@@ +1518,3 @@
           this._groups.remove (group);
+          if (emit_notification)
+            this.group_changed (group, false);

Please put braces around single-line ‘if’ blocks.
Comment 11 Jeremy Whiting 2012-09-07 00:24:06 UTC
Created attachment 223718 [details] [review]
Added emit_notification parameter to _update methods

Ah, right.  Ok I believe I got all the create_if_not_exist methods this time.
Comment 12 Philip Withnall 2012-09-07 07:04:07 UTC
Review of attachment 223718 [details] [review]:

Looks good to commit after making the fix below. Don’t forget to update NEWS.

Thanks!

::: backends/eds/lib/edsf-persona.vala
@@ +1728,3 @@
         }
+      if (in_google_personal_group != this._in_google_personal_group &&
+         emit_notification)

If (in_google_personal_group != this._in_google_personal_group) but (emit_notification == false), the _in_google_personal_group member will not be updated.
Comment 13 Guillaume Desmottes 2012-09-10 07:25:05 UTC
It works; thanks for the fix!