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 698275 - Enable/disable account yields to a several seconds busy loop
Enable/disable account yields to a several seconds busy loop
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Mailer
3.10.x (obsolete)
Other Linux
: Normal critical
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
: 708602 726097 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-04-18 09:10 UTC by Milan Crha
Modified: 2014-11-18 13:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
evo patch (11.07 KB, patch)
2013-08-21 10:51 UTC, Milan Crha
committed Details | Review

Description Milan Crha 2013-04-18 09:10:42 UTC
When I enable or disable an IMAP account, the UI freezes for several seconds and I see 100% CPU use during that freeze. I enable/disable the account in Edit->Preferences->Mail Accounts by clicking the Enabled column's checkbox.
I do not recall seeing this in the near past, and the only change I did was to create a new label named "[Gmail]/test" in evolution's labels, but even if I remove it I see the high CPU usage. Here's a backtrace for the main thread.

Thread 1 (Thread 0x7fc4a4e64a00 (LWP 23384))

  • #0 handlers_find
  • #1 signal_handlers_foreach_matched_R
  • #2 g_signal_handlers_disconnect_matched
  • #3 gtk_style_context_set_cascade
    at gtkstylecontext.c line 689
  • #4 gtk_style_context_finalize
    at gtkstylecontext.c line 854
  • #5 g_object_unref
    at gobject.c line 3023
  • #6 gtk_widget_finalize
    at gtkwidget.c line 10341
  • #7 g_object_unref
    at gobject.c line 3023
  • #8 gtk_menu_shell_forall
    at gtkmenushell.c line 1206
  • #9 rebuild_menu
    at gtktreemenu.c line 1369
  • #10 row_reordered_cb
    at gtktreemenu.c line 981
  • #11 g_closure_invoke
    at gclosure.c line 777
  • #12 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #13 g_signal_emit_valist
    at gsignal.c line 3300
  • #14 g_signal_emit
    at gsignal.c line 3356
  • #15 gtk_tree_model_rows_reordered
    at gtktreemodel.c line 1895
  • #16 gtk_list_store_sort_iter_changed
    at gtkliststore.c line 2045
  • #17 gtk_list_store_set_valist
    at gtkliststore.c line 1158
  • #18 gtk_list_store_set
    at gtkliststore.c line 1194
  • #19 e_action_combo_box_add_separator_after
    at e-action-combo-box.c line 580
  • #20 e_mail_shell_view_update_search_filter
    at e-mail-shell-view-actions.c line 2228
  • #21 g_closure_invoke
    at gclosure.c line 777
  • #22 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #23 g_signal_emit_valist
    at gsignal.c line 3300
  • #24 g_signal_emit
    at gsignal.c line 3356
  • #25 gtk_tree_model_row_deleted
    at gtktreemodel.c line 1867
  • #26 gtk_list_store_remove
    at gtkliststore.c line 1232
  • #27 gtk_list_store_clear
    at gtkliststore.c line 1446
  • #28 labels_settings_changed_cb
    at e-mail-label-list-store.c line 269
  • #29 g_cclosure_marshal_VOID__STRINGv
    at gmarshal.c line 1004
  • #30 _g_closure_invoke_va
    at gclosure.c line 840
  • #31 g_signal_emit_valist
    at gsignal.c line 3211
  • #32 g_signal_emit
    at gsignal.c line 3356
  • #33 g_settings_real_change_event
    at gsettings.c line 288
  • #34 ffi_call_unix64
    from /lib64/libffi.so.5
  • #35 ffi_call
    from /lib64/libffi.so.5
  • #36 g_cclosure_marshal_generic_va
    at gclosure.c line 1550
  • #37 _g_closure_invoke_va
    at gclosure.c line 840
  • #38 g_signal_emit_valist
    at gsignal.c line 3211
  • #39 g_signal_emit
    at gsignal.c line 3356
  • #40 settings_backend_path_changed
    at gsettings.c line 363
  • #41 settings_backend_path_changed
    at gsettings.c line 354
  • #42 g_settings_backend_invoke_closure
    at gsettingsbackend.c line 271
  • #43 g_main_dispatch
    at gmain.c line 2715
  • #44 g_main_context_dispatch
    at gmain.c line 3219
  • #45 g_main_context_iterate
    at gmain.c line 3290
  • #46 g_main_loop_run
    at gmain.c line 3484
  • #47 gtk_main
    at gtkmain.c line 1160
  • #48 main
    at main.c line 686

Comment 1 Milan Crha 2013-08-21 10:51:33 UTC
Created attachment 252519 [details] [review]
evo patch

for evolution;

The main problem is e-settings-deprecated module, which writes values unconditionally, which makes GSetting notify about changes (even nothing changed), then it goes through the Preferences dialog and back to e-settings-deprecated module (or some such path).

This patch does couple things:
a) write values back to deprecated GSettings keys only if they really changed
   (how nice it would be if GSettings do this on their own)
b) before updating EMailLabelListStore with a change from GSettings, check if
   anything changed at all - if not, then ignore the change
c) add "changed" signal to EMailLabelListStore, thus the listener(s) can listen
   for it, instead of row-changed, row-inserted and row-removed, which is
   delivered on each single change, even when refilling store at b), for
   each single row added
d) cumulate "changed" signal emission to idle, to cover as many consecutive
   notifications as possible. The changes are saved to GSettings just before
   the signal emission.

According to my tests, the call of e_mail_shell_view_update_search_filter() decreased significantly with this patch.
Comment 2 Milan Crha 2013-08-21 10:53:20 UTC
Created commit 996055c in evo master (3.9.91+)
Comment 3 Matthew Barnes 2013-09-23 13:12:10 UTC
*** Bug 708602 has been marked as a duplicate of this bug. ***
Comment 4 Milan Bouchet-Valat 2013-09-23 13:19:09 UTC
In my duplicate report, I can disable and re-enable accounts without any delay. But I'm not able to compose a new message.

Any chance to get a backport or a workaround to get Evo working again? :-p
Comment 5 Milan Crha 2013-09-23 16:10:37 UTC
You can always ask your distro maintainers to backport the patch to 3.8 (to which your bug is assigned). At least for me the issue happened only if I had opened Edit->Preferences, otherwise not - or not that often at least.
Comment 6 Milan Bouchet-Valat 2013-09-23 17:00:06 UTC
Not sure that's exactly the same bug... Are there some deprecated GSettings keys I can delete to work around this?

Yes, I can request a backport in Fedora. It's sad that in every new release Evo gets both fixes and new showstopper bugs... :-/
Comment 7 Milan Crha 2013-09-24 07:18:10 UTC
(In reply to comment #6)
> Not sure that's exactly the same bug... Are there some deprecated GSettings
> keys I can delete to work around this?

You cannot delete them, GSettings is more strict with compare of GConf.

> Yes, I can request a backport in Fedora.

Fedora? OK, I will build a test package for you (let's first test it, then create a real update if it'll work properly).

> It's sad that in every new release Evo
> gets both fixes and new showstopper bugs... :-/

I agree.
Comment 8 Milan Bouchet-Valat 2013-09-24 07:54:26 UTC
Great! ;-)
Comment 9 Milan Crha 2013-09-24 07:57:09 UTC
Maybe you are right, maybe you are not facing exactly the same bug (and/or there are multiple ways how to trigger this), because I realized that e-settings-deprecated.c/.h was introduced during 3.9 development cycle, thus it is not included in 3.8.x. Nonetheless, part of the patch still applies, thus I built a Fedora test package with it for you at:

   http://koji.fedoraproject.org/koji/taskinfo?taskID=5974745

In case it'll not help, please attach here labels.txt from this command:
   $ gsettings get org.gnome.evolution.mail labels >labels.txt
though I'm not sure whether it'll help, because even you get a busy-loop on the labels update, the trigger of the fake 'changed' signal from the GSettings can be elsewhere. You can try to run:
   $ gsettings monitor org.gnome.evolution.mail
and then open a composer window. The top of the output may give a clue where the flood begun. When I open a message composer (Ctrl+N in the Mailer view) then I do not see any activity from the GSettings monitor.
Comment 10 Milan Bouchet-Valat 2013-09-24 13:51:18 UTC
Funny. The first time I tried it hanged as before. But since I restarted it once again, the bug no longer happens.

Even more funny: I downgraded Evo back to the Fedora version, and it still works. So either the patched version allowed a GSettings key to be changed once for all, or there was something else going on. The problem is, I also restarted gnome-shell because when I made Evo hang for the last time, it ate much RAM and I noticed gnome-shell was using too much RAM too, and actually I was experiencing hangs of my desktop during a few seconds for some time.

So now I can't know whether this could be related or not... But the call to _gtk_tooltip_hide() in my stacktrace looks like it might, since tooltips are separate X windows, if I'm not mistaken.

So thank you very much for the fixed package, now Evo works as before. But I'm not sure we really progressed in the understanding of this bug... :-/



For the record:
$ gsettings get org.gnome.evolution.mail labels >labels.txt
['I_mportant:#EF2929', '_Work:#F57900', '_Personal:#4E9A06', '_To Do:#3465A4', '_Later:#75507B']

$ gsettings monitor org.gnome.evolution.mail
Does not show anything when composing a new message (at least with the patched version).
Comment 11 Milan Crha 2013-09-25 07:12:17 UTC
(In reply to comment #10)
> For the record:
> $ gsettings get org.gnome.evolution.mail labels >labels.txt
> ['I_mportant:#EF2929', '_Work:#F57900', '_Personal:#4E9A06', '_To Do:#3465A4',
> '_Later:#75507B']
> 
> $ gsettings monitor org.gnome.evolution.mail
> Does not show anything when composing a new message (at least with the patched
> version).

Pretty much the same here.

Good it works for you, bad we didn't get too far with it (the package revert and restart should prove usefulness of the change, but as it begun to work properly for you even with older package, then I agree with you, it's really hard to tell).
Comment 12 Milan Bouchet-Valat 2013-12-19 15:29:57 UTC
I've observed a similar hang today with Evo 3.10.3 (Fedora 20) when trying to create a new event in the agenda. I have created several events in a row without trouble right before that, but then Evo hanged while opening the window for this one.

Do you think it's the same bug?

(gdb) ba
  • #0 g_main_context_find_source_by_id
    at gmain.c line 2073
  • #1 g_source_remove
    at gmain.c line 2202
  • #2 task_shell_view_process_completed_tasks
    at e-task-shell-view-private.c line 78
  • #3 task_shell_view_hide_completed_tasks_changed_cb
    at e-task-shell-view-private.c line 92
  • #4 g_cclosure_marshal_VOID__STRINGv
    at gmarshal.c line 1004
  • #5 _g_closure_invoke_va
    at gclosure.c line 840
  • #6 g_signal_emit_valist
    at gsignal.c line 3238
  • #7 g_signal_emit
    at gsignal.c line 3386
  • #8 g_settings_real_change_event
  • #9 ffi_call_unix64
    at ../src/x86/unix64.S line 76
  • #10 ffi_call
    at ../src/x86/ffi64.c line 522
  • #11 g_cclosure_marshal_generic_va
    at gclosure.c line 1550
  • #12 _g_closure_invoke_va
    at gclosure.c line 840
  • #13 g_signal_emit_valist
    at gsignal.c line 3238
  • #14 g_signal_emit
    at gsignal.c line 3386
  • #15 settings_backend_path_changed
  • #16 g_settings_backend_invoke_closure
    at gsettingsbackend.c line 271
  • #17 g_main_dispatch
    at gmain.c line 3066
  • #18 g_main_context_dispatch
    at gmain.c line 3642
  • #19 g_main_context_iterate
    at gmain.c line 3713
  • #20 g_main_loop_run
    at gmain.c line 3907
  • #21 gtk_main
    at gtkmain.c line 1158
  • #22 main
    at main.c line 683

Comment 13 Milan Crha 2014-05-09 12:57:59 UTC
(In reply to comment #12)
> Do you think it's the same bug?

I'm quite late here, I'm sorry, but it seems this cured itself during the time. At least I tried to reproduce it with glib2-2.38.2-2.fc20.x86_64 and gtk3-3.10.6-1.3.fc20.x86_64 and latest evolution (git master, after 3.13.1), and I cannot repeat it.

My suspicious is that there happened some kid of ping-pong with change notifications on the GSettings side and widget side, and the two were not able to settle with correct value. This was the issue behind the change at comment #1. I mention glib2 here, because GSettings comes from there, thus they can also prevent this ping-pong. I do not have any exact change it there, I do not follow their changes at all, so it's possible nobody addressed this issue yet, still I do not seem to be able to reproduce it.

Can you still reproduce this? Maybe I only miss some tiny detail which prevents the issue to trigger.
Comment 14 Milan Bouchet-Valat 2014-05-10 17:26:54 UTC
No, I've not seen it for a while on Fedora 20.
Comment 15 Milan Crha 2014-06-04 18:37:47 UTC
I made more aggressive changes in evolution to address these false change notifications.

Created commit 2f3fbdd in evo master (3.13.3+) [1]
Created commit 9a8950a in evo evolution-3-12 (3.12.3+)

[1] https://git.gnome.org/browse/evolution/commit?id=2f3fbdd
Comment 16 Milan Crha 2014-06-05 10:00:22 UTC
(In reply to comment #15)
> I made more aggressive changes in evolution to address these false change
> notifications.
> 
> Created commit 2f3fbdd in evo master (3.13.3+) [1]
> Created commit 9a8950a in evo evolution-3-12 (3.12.3+)

Ehm, the changes had a little regression, thus I made follow-up commits. There will be done one more change, this time for dconf/GSettings key change handlers, which can be called incorrectly too.

Created commit 2e71c86 in evo master (3.13.3+) [2]
Created commit 3e5ad92 in evo evolution-3-12 (3.12.3+)

[2] https://git.gnome.org/browse/evolution/commit?id=2e71c86
Comment 17 Milan Crha 2014-06-05 15:07:38 UTC
The promised commits are (hopefully without regressions now):

Created commit 6e9e7b0 in evo master (3.13.3+) [3]
Created commit 7519575 in evo evolution-3-12 (3.12.3+)

[3] https://git.gnome.org/browse/evolution/commit?id=6e9e7b0
Comment 18 Milan Crha 2014-11-18 13:57:19 UTC
*** Bug 726097 has been marked as a duplicate of this bug. ***