Bug 1325487

Summary: [IMAPx] Release idle_lock before disconnecting the cancellable
Product: [Fedora] Fedora Reporter: Mikhail <mikhail.v.gavrilov>
Component: evolution-data-serverAssignee: Milan Crha <mcrha>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: lucilanga, mbarnes, mcrha, tpopela
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: evolution-data-server-3.20.2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-11 13:34:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
screenshot
none
backtraces
none
evolution console output none

Description Mikhail 2016-04-09 06:39:30 UTC
Created attachment 1145357 [details]
screenshot

Description of problem:
Evolution not hangs, but symptoms I see as earlier. Many spinners in the bottom panel. And on every spinner showed popup message "Release unused memory for folder 'INBOX'"

Comment 1 Mikhail 2016-04-09 06:42:35 UTC
Created attachment 1145358 [details]
backtraces

Comment 2 Mikhail 2016-04-09 06:44:40 UTC
Created attachment 1145359 [details]
evolution console output

Comment 3 Milan Crha 2016-04-11 13:34:04 UTC
Thanks for a bug report. I see that there are many threads trying to update the folder structure, read it from the server. There is also one thread disconnecting your IMAPx account, waiting for a lock (maybe that's the cause). The screenshot also shows an issue with .ru account, the code failed to obtain a password for it. I suppose you have it configured in the GNOME Online Accounts, thus it can be that the goa-daemon failed/crashed for some reason, then the evolution(-data-server) failed to ask the goa-daemon for the password. That all can be eventually related to an intermittent disconnect.

I think the problem is the Thread 15 and Thread 16 of the Evolution waiting on each other. Namely Thread 15 holds the GCancellable lock (as part of the g_cancellable_cancel() call) and is waiting for an idle_lock, of the CamelIMAPXServer in the imapx_server_wait_idle_stop_cancelled_cb().
The Thread 16 is holding the idle_lock in the camel_imapx_server_stop_idle_sync((), where it also calls g_cancellable_disconnect(), which seems to require the global GCancellable lock as well, but that one if held by the Thread 15 already.

I fixed this with the below commits, but it was too late for the 3.20.1 release, thus it's part of the next release.

Created commit 53dcb98 in eds master (3.21.1+) [1]
Created commit b59863d in eds gnome-3-20 (3.20.2+)

[1] https://git.gnome.org/browse/evolution-data-server/commit/?id=53dcb98