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 680961 - Broken dispatching of EAuthenticationSession
Broken dispatching of EAuthenticationSession
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: general
3.10.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
: 694739 708697 709013 709608 721644 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-08-01 09:52 UTC by Milan Crha
Modified: 2014-01-21 17:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
eds debug patch (9.41 KB, text/plain)
2012-08-15 13:56 UTC, Milan Crha
  Details
simpler eds debug patch (681 bytes, text/plain)
2012-08-16 06:31 UTC, Milan Crha
  Details
proposed eds patch (3.11 KB, patch)
2012-08-23 07:50 UTC, Milan Crha
needs-work Details | Review
yet-another eds debug patch (3.55 KB, text/plain)
2012-08-23 13:24 UTC, Milan Crha
  Details
yet-another version of the eds patch (1.38 KB, patch)
2012-08-24 11:47 UTC, Milan Crha
none Details | Review
proposed ed spatch (2.97 KB, patch)
2013-02-27 18:37 UTC, Milan Crha
none Details | Review
eds patch (5.89 KB, patch)
2013-11-25 21:31 UTC, Milan Crha
committed Details | Review

Description Milan Crha 2012-08-01 09:52:35 UTC
Also (bug #680960) after recent Matthew's changes, the "Retrieving "Out of Office" settings" never ends here. To be honest, I do not recall whether it ever worked, but I suppose it did, when Matthew was fixing it after account-mgmt merge.
Steps:
a) Open EWS account properties
b) select "Out of Office" section

See the bottom activity never ends, clicking Cancel beside the activity name does nothing too.
Comment 1 Matthew Barnes 2012-08-01 12:00:55 UTC
Seems to work fine here, although we probably need a way to cancel submitting data to the server if it gets stuck when you click OK.
Comment 2 Milan Crha 2012-08-01 12:30:46 UTC
I see in backtrace that this is waiting on reply from source-registry, but it either missed it, or something like that. I have two such threads now, because I opened EWS account Properties twice. The source-registry is idle, no thread doing anything.

Thread 2 (Thread 0x7f0e756ed700 (LWP 16335))

  • #0 poll
    from /lib64/libc.so.6
  • #1 ??
    from /lib64/libglib-2.0.so.0
  • #2 g_main_loop_run
    from /lib64/libglib-2.0.so.0
  • #3 e_source_registry_authenticate_sync
    at e-source-registry.c line 1685
  • #4 source_registry_authenticate_thread
    at e-source-registry.c line 1359
  • #5 ??
    from /lib64/libgio-2.0.so.0
  • #6 ??
    from /lib64/libgio-2.0.so.0
  • #7 ??
    from /lib64/libglib-2.0.so.0
  • #8 ??
    from /lib64/libglib-2.0.so.0
  • #9 start_thread
    from /lib64/libpthread.so.0
  • #10 clone
    from /lib64/libc.so.6

Comment 3 Milan Crha 2012-08-02 09:06:22 UTC
It seems to recover if I run source registry from a console, if I left it on D-Bus, then the previous behaviour is back again. This is what I see in the source-registry console.

AUTH (EWS): Initiated
AUTH (x): Initiated
AUTH (z): Initiated
AUTH (EWS): Complete (SUCCESS)
AUTH (x): Complete (SUCCESS)
AUTH (y): Initiated
AUTH (z): Complete (SUCCESS)
AUTH (y): Complete (SUCCESS)
AUTH (EWS): Initiated
AUTH (EWS): Complete (ERROR - Client cancelled the operation)
AUTH (EWS): Initiated
AUTH (EWS): Complete (ERROR - Client cancelled the operation)

The last two requests are from the time when I open Properties of the offending EWS account. The first is for OOO, the second is for Delegates (I work on now). I guess the error is misleading?
Comment 4 Milan Crha 2012-08-14 21:38:56 UTC
I'm setting this to blocker and moving to eds, because I cannot open any ews book. Steps:
a) close evolution and all related process
b) $ evolution -c contacts
d) when books from enabled ews accounts are shown select one of it
e) wait few seconds, might not do much
f) select another ews book - still nothing
g) get backtrace of running addressbook-factory
   see two threads stuck in e_source_registry_authenticate_sync() call
h) get backtrace of source-registry
   see all threads are idle
Comment 5 Milan Crha 2012-08-15 13:56:06 UTC
Created attachment 221254 [details]
eds debug patch

for evolution-data-server;

This adds tons of prints around authentication which helps to identify the issue.
Comment 6 Milan Crha 2012-08-15 14:07:30 UTC
After quite some investigation I found out (with the above patch) that the main problem is with authentication_session_execute(), when it is executed. Usual password prompts are executed on the main thread, with the default main context, which is all fine. This changes for ews, which on start calls e_backend_authenticate_sync() on a dedicated thread which has set its own thread default main context - ews is updating list of sources by checking for available folders. There happens this:
 - source registry starts
 - EWS starts to fetch its folders, with authentication still running
 - in evolution select EWS book
 - book factory starts auth request, and waits
 - in source registry the book's auth request is received and it's piled into
   the group of waiting, because this one is still pending
 - ews finished folder sync, and thus also closes the below thread, but
   the authentication_session_execute_thread() is finished on IDLE in the main
   context which authentication_session_execute() had as the thread's default,
   which is just gone now, thus the callback is never called

Or something along that causes the issue, basically the authentication_session_execute() should be always run in the main thread, or in a thread which doesn't get rid of the main context before it is able to receive pending requests.

Breakpoint 1, authentication_session_execute (session=0x7fffb4004360 [EAuthenticationSession], io_priority=0, cancellable=0x0, callback=0x7ffff7dd6afb <source_registry_server_auth_session_cb>, user_data=
    0xc03100) at e-authentication-session.c:656
656		g_return_if_fail (E_IS_AUTHENTICATION_SESSION (session));
(gdb) bt
  • #0 authentication_session_execute
    at e-authentication-session.c line 656
  • #1 e_authentication_session_execute
    at e-authentication-session.c line 1219
  • #2 source_registry_server_maybe_start_auth_session
    at e-source-registry-server.c line 559
  • #3 e_source_registry_server_authenticate
    at e-source-registry-server.c line 2116
  • #4 e_source_registry_server_authenticate_sync
    at e-source-registry-server.c line 2056
  • #5 collection_backend_authenticate_sync
    at e-collection-backend.c line 643
  • #6 e_backend_authenticate_sync
    at e-backend.c line 391
  • #7 e_ews_backend_ref_connection_sync
    at e-ews-backend.c line 941
  • #8 e_ews_backend_sync_folders_sync
    at e-ews-backend.c line 1034
  • #9 ews_backend_sync_folders_thread
    at e-ews-backend.c line 1012
  • #10 run_in_thread
    at gsimpleasyncresult.c line 861
  • #11 io_job_thread
    at gioscheduler.c line 177
  • #12 g_thread_pool_thread_proxy
    at gthreadpool.c line 309
  • #13 g_thread_proxy
    at gthread.c line 801
  • #14 start_thread
    from /lib64/libpthread.so.0
  • #15 clone
    from /lib64/libc.so.6
Continuing.
[New Thread 0x7fffba7fc700 (LWP 30285)]
   authentication_session_execute: for uid '1342640443.11026.89@zyxPad' mc:0x7fffac002800 default:0
Comment 7 Matthew Barnes 2012-08-15 21:57:45 UTC
Still not able to reproduce the problem for some reason, but I think I at least understand it in theory.  I changed EAuthenticationMediator to export its D-Bus interface from an isolated thread so its signal emissions can't be inhibited by something calling g_main_context_push_thread_default().

Basically the same hack I had to add to ESourceRegistry.

Don't know if it fixes this bug, but authentication still works for me.

Can you retest with this commit?

http://git.gnome.org/browse/evolution-data-server/commit/?id=e13cb4e0ba820694f908fe39255ff8f7a6239038
Comment 8 Milan Crha 2012-08-16 06:31:15 UTC
Created attachment 221345 [details]
simpler eds debug patch

Unfortunately not, it's still broken. This is easier debug patch, please apply it and, with at least one EWS account configured and enabled, run the source registry on console like this:
   $ ./evolution-source-registry >/dev/null

you'll then see error messages only. This issue will be fine once there will be no line like this in the console output of the source registry:
   authentication_session_execute: '1344263232.10334.4@zyxPad' on default context:0

aka each "on default context" should be 1. It is 1 for remote requests (like if I run evolution and it asks for passwords for mail accounts), but 0 for local requests. It worked for remote requests even before your recent change.
Comment 9 Milan Crha 2012-08-16 09:30:07 UTC
I'm afraid your latest change caused this crash (it calls g_thread_join() in a thread which it tries to join).

Thread 2 (Thread 0x7fad797fa700 (LWP 24595))

  • #0 waitpid
    from /lib64/libpthread.so.0
  • #1 g_spawn_sync
    at gspawn.c line 405
  • #2 g_spawn_command_line_sync
    at gspawn.c line 722
  • #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 g_logv
  • #7 g_log
  • #8 g_system_thread_wait
    at gthread-posix.c line 1158
  • #9 g_thread_join
    at gthread.c line 966
  • #10 authentication_mediator_dispose
    at e-authentication-mediator.c line 575
  • #11 g_object_unref
    at gobject.c line 2981
  • #12 g_simple_async_result_finalize
    at gsimpleasyncresult.c line 270
  • #13 g_object_unref
    at gobject.c line 3018
  • #14 authentication_mediator_handle_accepted
    at e-authentication-mediator.c line 331
  • #15 ffi_call_unix64
    from /lib64/libffi.so.5
  • #16 ffi_call
    from /lib64/libffi.so.5
  • #17 g_cclosure_marshal_generic
    at gclosure.c line 1454
  • #18 g_closure_invoke
    at gclosure.c line 777
  • #19 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #20 g_signal_emitv
    at gsignal.c line 3041
  • #21 _e_dbus_authenticator_skeleton_handle_method_call
    at e-dbus-authenticator.c line 1367
  • #22 g_dbus_interface_method_dispatch_helper
    at gdbusinterfaceskeleton.c line 615
  • #23 skeleton_intercept_handle_method_call
    at gdbusinterfaceskeleton.c line 655
  • #24 call_in_idle_cb
    at gdbusconnection.c line 4687
  • #25 g_main_dispatch
    at gmain.c line 2539
  • #26 g_main_context_dispatch
    at gmain.c line 3075
  • #27 g_main_context_iterate
    at gmain.c line 3146
  • #28 g_main_loop_run
    at gmain.c line 3340
  • #29 authentication_mediator_authenticator_thread
    at e-authentication-mediator.c line 459
  • #30 g_thread_proxy
    at gthread.c line 801
  • #31 start_thread
    from /lib64/libpthread.so.0
  • #32 clone
    from /lib64/libc.so.6

Comment 10 Matthew Barnes 2012-08-16 11:48:59 UTC
(In reply to comment #9)
> I'm afraid your latest change caused this crash (it calls g_thread_join() in a
> thread which it tries to join).

Okay, I'm going to revert the change then since it doesn't solve the problem and it was stable for me before.
Comment 11 Matthew Barnes 2012-08-16 13:59:26 UTC
(In reply to comment #4)
> I'm setting this to blocker and moving to eds, because I cannot open any ews
> book. Steps:
> a) close evolution and all related process
> b) $ evolution -c contacts
> d) when books from enabled ews accounts are shown select one of it
> e) wait few seconds, might not do much
> f) select another ews book - still nothing
> g) get backtrace of running addressbook-factory
>    see two threads stuck in e_source_registry_authenticate_sync() call
> h) get backtrace of source-registry
>    see all threads are idle

Following these steps using that latest git revision still works fine for me.  Using our "gss-test1" account, I get contacts shown for the "Contacts" and "shared-book-mcrha" address books when I click on the in the sidebar.

Seems like maybe we're looking in the wrong place here.
Comment 12 Matthew Barnes 2012-08-16 14:05:08 UTC
FWIW, on my build that works:

$ pkg-config --modversion glib-2.0     =>  2.32.3
$ pkg-config --modversion gtk+-3.0     =>  3.4.2
$ pkg-config --modversion libsoup-2.4  =>  2.38.1
Comment 13 Milan Crha 2012-08-17 09:10:34 UTC
I use slightly newer glib, 2.32.4, and gtk3, 3.4.3. Libsoup is the same. Try to login to my account (mcrha, same password), I have configured more sources, though from my point of view, if you apply debug patch from comment #8 and test it, then you'll also see the "default context:0" on the console.
Comment 14 Matthew Barnes 2012-08-17 13:09:05 UTC
Looking at your debug patch, it's making wrong assumptions.  The authentication session does not need to run on the global default main context.

The Authenticator D-Bus interface will emit signals from whatever was the thread-default main context on the current thread at the time the interface was exported.

The problem I thought I was correcting with the now-reverted patch was that the thread-default main context may be different when the D-Bus interface is first exported versus when the try_password() method is invoked.  try_password() relies on receiving a D-Bus signal -- either Accepted or Rejected or Cancel -- in order to complete, but if the D-Bus signals are being suppressed by a different thread-default main context then try_password() eventually just time out after several minutes.

That said, I set up an EWS account with your user name and I think I might be seeing the problem now.  But the gss-test1 account still works fine.  Odd.

I'll dig further.
Comment 15 Matthew Barnes 2012-08-17 13:46:39 UTC
(In reply to comment #14)
> That said, I set up an EWS account with your user name and I think I might be
> seeing the problem now.

I take it back.  I think it was just taking awhile to download contacts but all your address books show content for me now.  I even stopped everything, cleared out the caches, and retested per comment #6 and contacts show up fine after a short syncing delay.

So I still can't reproduce whatever it is you're seeing.
Comment 16 Milan Crha 2012-08-20 15:57:57 UTC
I didn't download changes in the folder, it was already done. If you look into backtrace of comment #6, the authentication_session_execute() is called inside ews_backend_sync_folders_thread(). The this is that the authentication_session_execute() creates a new GSimpleAsyncResult, which remembers default_thread_context, which is currently tight to something from the backtrace in comment #6, and this thing is removed before the simple async result is delivered on "idle". That's my current theory about the issue.

To be able to successfully reproduce this, you might want follow steps from comment #4 and make sure your request for authentication from step d), aka when selecting ews book, will be piled into waiting, aka the ews_backend_sync_folders_thread() will not be finished yet when you'll select the book in UI. It's quite easy here.

By the way, do you see, with the debug patch, that the default context is 0?
Comment 17 Milan Crha 2012-08-23 07:50:59 UTC
Created attachment 222205 [details] [review]
proposed eds patch

for evolution-data-server;

This change makes it work properly for me. I verified with my debug patch that this does what it should.

It's enough to "pretend" authentication_session_execute() is run with the default main context as a thread default context and I can reproduce the issue again.
Comment 18 Matthew Barnes 2012-08-23 11:43:02 UTC
Okay, so it looks like the execute() method needs to run in a particular main context, but we can't assume it's always the global default main context.  I'm sure that's a coincidence.

Probably we need to break API and have e_authentication_session_new() explicitly take a GMainContext argument from whatever currently HAPPENS to be using the global default main context, and then have e_authentication_session_execute() schedule an idle source on the GMainContext we were given.  The idle source will then execute the authentication session, similar to the helper function in your patch.
Comment 19 Matthew Barnes 2012-08-23 11:59:07 UTC
(In reply to comment #18)
> Probably we need to break API and have e_authentication_session_new()
> explicitly take a GMainContext argument from whatever currently HAPPENS to be
> using the global default main context, and then have
> e_authentication_session_execute() schedule an idle source on the GMainContext
> we were given.  The idle source will then execute the authentication session,
> similar to the helper function in your patch.

Actually, EAuthenticationSession is the wrong place to do this.

e_authentication_mediator_new() should take the GMainContext argument and execute its try_password() method from an idle callback on that GMainContext.  That would get at the problem I was trying to solve with my first patch, and makes more sense to me as to why its needed.
Comment 20 Milan Crha 2012-08-23 12:43:35 UTC
Are you sure? Check the backtrace in comment #6, there is none try_password() in it.
Comment 21 Milan Crha 2012-08-23 13:24:30 UTC
Created attachment 222223 [details]
yet-another eds debug patch

for evolution-data-server;

So, the evil is e_async_closure_new(), called from e_source_registry_server_authenticate_sync(),  which sets its own default thread context, which this debug patch proves. Before it (and after freeing the EAsyncClosure) the default thread context is the same as the default main context.
Comment 22 Milan Crha 2012-08-23 13:26:43 UTC
Here's the relevant output:

collection_backend_authenticate_sync: '1344263232.10334.4@zyxPad' on default context:1, thread_default:(nil)

   e_source_registry_server_authenticate_sync: before closure_new '1344263232.10334.4@zyxPad' on default context:1, thread_default:(nil)

   e_source_registry_server_authenticate_sync: after closure_new '1344263232.10334.4@zyxPad' on default context:0, thread_default:0x7faf10005ce0
authentication_session_execute: '1344263232.10334.4@zyxPad' on default context:0, thread_default:0x7faf10005ce0

...

   e_source_registry_server_authenticate_sync: before finish '1344263232.10334.4@zyxPad' on default context:0, thread_default:0x7faf10005ce0

   e_source_registry_server_authenticate_sync: after closure_free '1344263232.10334.4@zyxPad' on default context:1, thread_default:(nil)
Comment 23 Matthew Barnes 2012-08-23 14:17:45 UTC
Can you break on e_source_registry_server_authenticate_sync() and then post a full backtrace with all threads?
Comment 24 Milan Crha 2012-08-23 15:09:20 UTC
Here you are. This is for the first call:

Breakpoint 1, e_source_registry_server_authenticate_sync (server=0x762010 [ESourceRegistryServer], session=0x7fffd401a800 [EAuthenticationSession], cancellable=0x0, error=0x7fffdc595bb8)
    at e-source-registry-server.c:2038
2038		g_return_val_if_fail (E_IS_SOURCE_REGISTRY_SERVER (server), FALSE);
(gdb) t a a bt

Thread 1 (Thread 0x7ffff72bc980 (LWP 19807))

  • #0 _dbus_type_reader_recurse
    at dbus-marshal-recursive.c line 1021
  • #1 base_reader_next
    at dbus-marshal-recursive.c line 442
  • #2 struct_reader_next
    at dbus-marshal-recursive.c line 495
  • #3 _dbus_type_reader_next
    at dbus-marshal-recursive.c line 1055
  • #4 writer_write_reader_helper
    at dbus-marshal-recursive.c line 2618
  • #5 writer_write_reader_helper
    at dbus-marshal-recursive.c line 2511
  • #6 writer_write_reader_helper
    at dbus-marshal-recursive.c line 2511
  • #7 _dbus_type_writer_write_reader_partial
    at dbus-marshal-recursive.c line 2683
  • #8 replacement_block_replace
    at dbus-marshal-recursive.c line 1182
  • #9 reader_set_basic_variable_length
    at dbus-marshal-recursive.c line 1288
  • #10 _dbus_type_reader_set_basic
    at dbus-marshal-recursive.c line 1382
  • #11 set_basic_field
    at dbus-marshal-header.c line 357
  • #12 _dbus_header_set_field_basic
    at dbus-marshal-header.c line 1265
  • #13 _dbus_message_iter_close_signature
    at dbus-message.c line 2393
  • #14 dbus_message_iter_close_container
    at dbus-message.c line 2783
  • #15 _g_dbus_message_iter_append_cstring
    from /lib64/libgvfscommon.so.0
  • #16 _g_dbus_message_iter_append_args_valist
    from /lib64/libgvfscommon.so.0
  • #17 _g_dbus_message_append_args_valist
    from /lib64/libgvfscommon.so.0
  • #18 _g_dbus_message_append_args
    from /lib64/libgvfscommon.so.0
  • #19 ??
    from /usr/lib64/gio/modules/libgvfsdbus.so
  • #20 g_local_file_move
    at glocalfile.c line 2363
  • #21 g_file_move
  • #22 cache_reaper_move_directory
    at module-cache-reaper.c line 210
  • #23 cache_reaper_recover_from_trash
    at module-cache-reaper.c line 403
  • #24 cache_reaper_source_added_cb
    at module-cache-reaper.c line 443
  • #25 g_closure_invoke
    at gclosure.c line 777
  • #26 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #27 g_signal_emit_valist
    at gsignal.c line 3300
  • #28 g_signal_emit
    at gsignal.c line 3356
  • #29 e_source_registry_server_add_source
    at e-source-registry-server.c line 1443
  • #30 ews_backend_add_gal_source
    at e-ews-backend.c line 413
  • #31 ews_backend_populate
    at e-ews-backend.c line 576
  • #32 collection_backend_populate_idle_cb
    at e-collection-backend.c line 456
  • #33 g_main_dispatch
    at gmain.c line 2539
  • #34 g_main_context_dispatch
    at gmain.c line 3075
  • #35 g_main_context_iterate
    at gmain.c line 3146
  • #36 g_main_loop_run
    at gmain.c line 3340
  • #37 dbus_server_run_server
    at e-dbus-server.c line 222
  • #38 ffi_call_unix64
    from /lib64/libffi.so.5
  • #39 ffi_call
    from /lib64/libffi.so.5
  • #40 g_cclosure_marshal_generic_va
    at gclosure.c line 1550
  • #41 _g_closure_invoke_va
    at gclosure.c line 840
  • #42 g_signal_emit_valist
    at gsignal.c line 3211
  • #43 g_signal_emit
    at gsignal.c line 3356
  • #44 e_dbus_server_run
    at e-dbus-server.c line 396
  • #45 main
    at evolution-source-registry.c line 85

Comment 25 Milan Crha 2012-08-23 15:10:24 UTC
This is for the last. I have about 4 calls of it:

Breakpoint 1, e_source_registry_server_authenticate_sync (server=0x762010 [ESourceRegistryServer], session=0x7fffac001c00 [EAuthenticationSession], cancellable=0x0, error=0x7fffbaffcbb8)
    at e-source-registry-server.c:2038
2038		g_return_val_if_fail (E_IS_SOURCE_REGISTRY_SERVER (server), FALSE);
(gdb) t a a bt

Thread 1 (Thread 0x7ffff72bc980 (LWP 19807))

  • #0 type_lookup_iface_vtable_I
    at gtype.c line 619
  • #1 type_lookup_iface_vtable_I
    at gtype.c line 3495
  • #2 type_node_check_conformities_UorL
    at gtype.c line 3450
  • #3 type_node_conforms_to_U
    at gtype.c line 3480
  • #4 g_type_is_a
    at gtype.c line 3503
  • #5 pool_depth_list
    at gparam.c line 1218
  • #6 g_hash_table_foreach
    at ghash.c line 1524
  • #7 g_param_spec_pool_list
    at gparam.c line 1290
  • #8 g_object_class_list_properties
    at gobject.c line 900
  • #9 source_load_from_key_file
    at e-source.c line 543
  • #10 e_source_get_extension
    at e-source.c line 2026
  • #11 ews_backend_add_gal_source
    at e-ews-backend.c line 401
  • #12 ews_backend_populate
    at e-ews-backend.c line 576
  • #13 collection_backend_populate_idle_cb
    at e-collection-backend.c line 456
  • #14 g_main_dispatch
    at gmain.c line 2539
  • #15 g_main_context_dispatch
    at gmain.c line 3075
  • #16 g_main_context_iterate
    at gmain.c line 3146
  • #17 g_main_loop_run
    at gmain.c line 3340
  • #18 dbus_server_run_server
    at e-dbus-server.c line 222
  • #19 ffi_call_unix64
    from /lib64/libffi.so.5
  • #20 ffi_call
    from /lib64/libffi.so.5
  • #21 g_cclosure_marshal_generic_va
    at gclosure.c line 1550
  • #22 _g_closure_invoke_va
    at gclosure.c line 840
  • #23 g_signal_emit_valist
    at gsignal.c line 3211
  • #24 g_signal_emit
    at gsignal.c line 3356
  • #25 e_dbus_server_run
    at e-dbus-server.c line 396
  • #26 main
    at evolution-source-registry.c line 85

Comment 26 Matthew Barnes 2012-08-24 01:07:31 UTC
I recommitted my original solution from comment #7 with improved thread-safety, just to eliminate EAuthenticationMediator from the equation.  Running a GDBusInterface in an isolated thread where its signals can't be inhibited by other code is still the best approach, imo.

http://git.gnome.org/browse/evolution-data-server/commit/?id=43931f398f0289fac528489a01c8404c231b9f61

I still want to get to the bottom of WHY e_source_registry_server_authenticate_sync() works in one main context but not another.  There's a deeper issue here, and I want to understand it and not just hack around it.
Comment 27 Milan Crha 2012-08-24 08:57:32 UTC
No, it doesn't work, furthermore, it's worse then before. The first start I didn't get any other than GAL from my ews account, the evolution was stuck in waiting for authentication on mailer part (why is that running when I run in contacts i really do not understand) with source registry being idle.

The second start I got list of other books from ews account, but they didn't open again. The book factory was waiting for a response, the source registry in this state:

Thread 1 (Thread 0x7f8b642ae980 (LWP 9212))

  • #0 poll
    from /lib64/libc.so.6
  • #1 g_main_context_poll
    at gmain.c line 3440
  • #2 g_main_context_iterate
    at gmain.c line 3141
  • #3 g_main_loop_run
    at gmain.c line 3340
  • #4 dbus_server_run_server
    at e-dbus-server.c line 222
  • #5 ffi_call_unix64
    from /lib64/libffi.so.5
  • #6 ffi_call
    from /lib64/libffi.so.5
  • #7 g_cclosure_marshal_generic_va
    at gclosure.c line 1550
  • #8 _g_closure_invoke_va
    at gclosure.c line 840
  • #9 g_signal_emit_valist
    at gsignal.c line 3211
  • #10 g_signal_emit
    at gsignal.c line 3356
  • #11 e_dbus_server_run
    at e-dbus-server.c line 396
  • #12 main
    at evolution-source-registry.c line 85

Comment 28 Milan Crha 2012-08-24 11:47:46 UTC
Created attachment 222301 [details] [review]
yet-another version of the eds patch

for evolution-data-server;

nailed down to source_registry_server_maybe_start_auth_session().
Comment 29 Matthew Barnes 2012-08-24 17:58:14 UTC
Fixed in:
http://git.gnome.org/browse/evolution-data-server/commit/?id=4afcf9c43a1141230d270974d6d20d0bf9396414

Similar to your patch, but uses an explicit main context instead of assuming the default.
Comment 30 Milan Crha 2012-11-28 11:59:48 UTC
It seems there's a regression on this, see downstream bug from F18 Beta, which has 3.6.2-2 of evolution and 3.6.2-1 of evolution-data-server:
https://bugzilla.redhat.com/show_bug.cgi?id=880825
Comment 31 Milan Crha 2013-02-27 18:33:31 UTC
*** Bug 694739 has been marked as a duplicate of this bug. ***
Comment 32 Milan Crha 2013-02-27 18:34:30 UTC
I'm reopening this due to more people facing this issue in 3.6.x.
Comment 33 Milan Crha 2013-02-27 18:37:47 UTC
Created attachment 237554 [details] [review]
proposed ed spatch 

for evolution-data-server;

This reverts change from comment #29 and adds change from comment #28.

Using g_main_context_ref_thread_default() this way leads to similar issues,
aka is plain wrong. Prove above.
Comment 34 Matěj Cepl 2013-03-08 15:41:26 UTC
It seems to be better with Milan’s patch. I can do now search and save messages for offline (both feats I had not been able to achieve previously).
Comment 35 Matěj Cepl 2013-03-08 16:06:35 UTC
Although however, when I was trying to Quit Evolution now I still got it frozen (of course, I have no clue whether this is the same issue as before):

(gdb) t a a bt

Thread 1 (Thread 0x7fc417959a00 (LWP 21615))

  • #0 memchr
    from /lib64/libc.so.6
  • #1 camel_url_new_with_base
    at camel-url.c line 170
  • #2 camel_url_new
    at camel-url.c line 325
  • #3 e_mail_folder_uri_parse
  • #4 e_mail_folder_uri_equal
    at e-mail-folder-utils.c line 1941
  • #5 em_utils_folder_is_sent
    at e-mail-utils.c line 237
  • #6 update_1folder
    at mail-folder-cache.c line 360
  • #7 setup_folder
    at mail-folder-cache.c line 551
  • #8 store_folder_subscribed_cb
    at mail-folder-cache.c line 599
  • #9 g_closure_invoke
    from /lib64/libgobject-2.0.so.0
  • #10 signal_emit_unlocked_R
    from /lib64/libgobject-2.0.so.0
  • #11 g_signal_emit_valist
    from /lib64/libgobject-2.0.so.0
  • #12 g_signal_emit
    from /lib64/libgobject-2.0.so.0
  • #13 store_emit_folder_created_cb
    at camel-store.c line 135
  • #14 g_main_context_dispatch
    from /lib64/libglib-2.0.so.0
  • #15 g_main_context_iterate.isra.24
    from /lib64/libglib-2.0.so.0
  • #16 g_main_loop_run
    from /lib64/libglib-2.0.so.0
  • #17 gtk_main
    from /lib64/libgtk-3.so.0
  • #18 main
    at main.c line 711

Comment 36 Milan Crha 2013-09-30 16:44:09 UTC
*** Bug 708697 has been marked as a duplicate of this bug. ***
Comment 37 Milan Crha 2013-10-07 10:34:26 UTC
*** Bug 709013 has been marked as a duplicate of this bug. ***
Comment 38 Milan Crha 2013-11-22 19:30:24 UTC
I am able to reproduce this when I have configured a GOA EWS account and I change password on the server, thus the one stored in keyring is outdated. Then evolution can get into this state of "waiting for nothing in e_source_registry_authenticate_sync".
Comment 39 Milan Crha 2013-11-25 21:31:38 UTC
Created attachment 261486 [details] [review]
eds patch

for evolution-data-server;

There was basically no error reporting from the server to the client when any such occurred during authentication on the server side, thus the client was left waiting for a response which never happened. Even the 'dismiss' signal has a comment that it can be used for such cases, it's not the right thing to do, because it hides the errors from a user, thus he/she doesn't know that something went wrong. For that a new ServerError signal was added and the error is properly propagated to the client. Note the GOA errors don't strip the GDBus error from the message, which looks odd in the UI, thus I added a workaround for that too.
Comment 40 Milan Crha 2013-11-25 21:34:09 UTC
Created commit eaf23db in eds master (3.11.3+)
Created commit 25ddf92 in eds gnome-3-10 (3.10.3+)
Comment 41 Milan Crha 2013-11-25 21:36:07 UTC
*** Bug 709608 has been marked as a duplicate of this bug. ***
Comment 42 Milan Crha 2014-01-21 17:38:51 UTC
*** Bug 721644 has been marked as a duplicate of this bug. ***