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 681837 - Make enum type registration thread safe
Make enum type registration thread safe
Status: RESOLVED FIXED
Product: evolution-ews
Classification: Other
Component: Mail
3.5.x
Other Linux
: Normal critical
: ---
Assigned To: Evolution EWS maintainer(s)
Evolution EWS maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-08-14 13:14 UTC by Milan Crha
Modified: 2013-04-12 07:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ews patch (853 bytes, patch)
2013-04-11 17:48 UTC, Milan Crha
committed Details | Review
ews patch ][ (4.40 KB, patch)
2013-04-11 18:22 UTC, Milan Crha
committed Details | Review

Description Milan Crha 2012-08-14 13:14:07 UTC
I get this crash quite often, and because it's a recent change, then I do not think it's an old thing. The console is full of critical warnings:
(evolution:6626): GLib-GObject-WARNING **: cannot register existing type `EEwsFolderType'

(evolution:6626): GLib-GObject-WARNING **: cannot retrieve class for invalid (unclassed) type `<invalid>'

(evolution:6626): GLib-GObject-WARNING **: cannot register existing type `EEwsFolderType'

(evolution:6626): GLib-GObject-WARNING **: cannot retrieve class for invalid (unclassed) type `<invalid>'

I suppose it's some linking issue. I get this when I run all evolution processes from scratch (none DBus service is running when I run evolution), though I do not think this has anything to do with it. Note I have EWS account enabled.

Thread 9 (Thread 0x7f14ea417700 (LWP 6661))

  • #0 waitpid
    from /lib64/libpthread.so.0
  • #1 g_spawn_sync
    from /lib64/libglib-2.0.so.0
  • #2 g_spawn_command_line_sync
    from /lib64/libglib-2.0.so.0
  • #3 run_bug_buddy
    at gnome-segvhanlder.c line 240
  • #4 bugbuddy_segv_handle
    at gnome-segvhanlder.c line 191
  • #5 <signal handler called>
  • #6 raise
    from /lib64/libc.so.6
  • #7 abort
    from /lib64/libc.so.6
  • #8 __libc_message
    from /lib64/libc.so.6
  • #9 _int_free
    from /lib64/libc.so.6
  • #10 g_free
    from /lib64/libglib-2.0.so.0
  • #11 circ_add
  • #12 bug_buddy_log_handler
  • #13 g_logv
    from /lib64/libglib-2.0.so.0
  • #14 g_log
    from /lib64/libglib-2.0.so.0
  • #15 g_enum_get_value_by_nick
    from /lib64/libgobject-2.0.so.0
  • #16 e_ews_folder_type_from_nick
    at e-ews-folder.c line 233
  • #17 camel_ews_store_summary_get_folder_type
    at camel-ews-store-summary.c line 725
  • #18 folder_info_from_store_summary
    at camel-ews-store.c line 827
  • #19 ews_get_folder_info_sync
    at camel-ews-store.c line 989
  • #20 camel_store_get_folder_info_sync
  • #21 store_get_folder_info_thread
    at camel-store.c line 506
  • #22 ??
    from /lib64/libgio-2.0.so.0
  • #23 ??
    from /lib64/libgio-2.0.so.0
  • #24 ??
    from /lib64/libglib-2.0.so.0
  • #25 ??
    from /lib64/libglib-2.0.so.0
  • #26 start_thread
    from /lib64/libpthread.so.0
  • #27 clone
    from /lib64/libc.so.6

Comment 1 Matthew Barnes 2012-08-17 23:38:41 UTC
I haven't seen this yet myself.

I introduced the GType for EEwsFolderType recently after I caught the "folder-tree" file storing enum values numerically, which is bad.

http://git.gnome.org/browse/evolution-ews/commit/?id=3b1b92a4ad3deaa95c0b848415101f03c315b476
Comment 2 Milan Crha 2012-08-20 10:23:33 UTC
It's for me one of two/three runs, sometimes more succeed, then other die. I always close everything (factories and source registry included) and run evolution from scratch.
Comment 3 Milan Crha 2012-08-28 15:01:46 UTC
Just an update on this: it is shown for me mostly if I run in mailer with selected EWS' Inbox folder. Basically:
a) make sure you have selected EWS' Inbox before closing evolution
b) close all evolution processes
c) run evolution in mailer (evolution -c mail)
d) wait till the initial password check is done, then EWS folders are loaded
   and the Inbox is likely to be selected, but instead, console is full of
   warnings like in comment #0 and evolution either crashes or shows almost
   no EWS folder.

If I change folder before they are loaded, like if I select On This Computer/Inbox, then I can select EWS' Inbox afterwards with no issue.
Again, this is timing related.
Comment 4 Milan Crha 2013-04-11 17:48:05 UTC
Created attachment 241287 [details] [review]
ews patch

for evolution-ews;

OK, even the previous steps were not enough, it was pretty inconsistent for me to reproduce this. I thought that this is caused by a library reload, the ews lib, but it isn't it. I managed to reproduce this under gdb, finally, and evolution was partly consistently claiming the issue on the already registered type. The reason is that the two threads were calling e_ews_folder_type_get_type() in the same time, and for the first time, but the function as such is not thread safe, thus this thread interleave caused the crash. I'm fixing the .template file, to make it thread safe, in ews and other evolution related sources as well.
Comment 5 Matthew Barnes 2013-04-11 17:51:07 UTC
+1  Nice catch.
Comment 6 Milan Crha 2013-04-11 18:22:01 UTC
Created attachment 241289 [details] [review]
ews patch ][

for evolution-ews;

This change is even better, I can use one template to generate any enum types, which I will simply reuse in evo and eds, instead of copy templates around the sources (within one tree).
Comment 7 Milan Crha 2013-04-11 18:36:25 UTC
Created commit 5fbcfaf in ews master (3.9.1+)
Created commit d3ed6d9 in ews gnome-3-8 (3.8.1+)

(I'll do the other evolution core products tomorrow, battery is low.) :-/
Comment 8 Milan Crha 2013-04-11 18:58:37 UTC
Err, EXTRA_DIST required a change too, thus commit a866d03 on master and commit bd81fd0 on gnome-3-8.
Comment 9 Milan Crha 2013-04-12 07:53:59 UTC
Created commit 5e858bb in eds master (3.9.1+)
Created commit 1c5f631 in evo master (3.9.1+)

Created commit f41d408 in eds gnome-3-8 (3.8.1+)
created commit 8c25144 in evo gnome-3-8 (3.8.1+)