Bug 1398531

Summary: Autodiscover can cause deadlock in GCancellable code
Product: [Fedora] Fedora Reporter: Aaron Lu <aaron.lwe>
Component: evolution-ewsAssignee: Milan Crha <mcrha>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: lucilanga, mbarnes, mcrha, tpopela
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: evolution-ews-3.22.3 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-30 18:47:31 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 of the hang
none
backtrace retrieved when evolution is frozen none

Description Aaron Lu 2016-11-25 06:28:25 UTC
Created attachment 1224154 [details]
Screenshot of the hang

Description of problem:
During set up a new mail account, the step "Importing Files" will hang

Version-Release number of selected component (if applicable):
evolution-3.22.1-2.fc25.x86_64
evolution-data-server-3.22.1-1.fc25.x86_64
evolution-help-3.22.1-2.fc25.noarch
evolution-ews-3.22.1-1.fc25.x86_64

How reproducible:
Always

Steps to Reproduce:
1. setup a new mail account with evolution
2. 
3.

Actual results:
Can not pass "Importing Files" step

Expected results:
Pass all the steps and done

Additional info:
It doesn't matter if Mail and Address Book is selected or not, the hang always occurred.

Comment 1 Milan Crha 2016-11-28 09:59:36 UTC
Thanks for a bug report. I tried to reproduce it, but not much luck. I created only one contact in the `alpine`, and had there only one message saved, and also one in the Inbox. It took quite some time to finish the task of the 'Import Files', but at least the screen changed right to "Importing..." after I clicked "Next" on the page you've a screenshot from.

I suppose you run a Wayland session, right? I did.

Could you try to run the evolution from a console, please? Maybe there will be anything interesting. A backtrace of the frozen evolution would also help, to see where it froze. Ideally install debuginfo packages as follows:

   # dnf install evolution-data-server-debuginfo evolution-debuginfo \
        gtk3-debuginfo --enablerepo=updates-debuginfo

ad make sure that the installed package versions exactly match those already installed. Otherwise issue also:

   # dnf update evolution-data-server evolution gtk3

You can get the backtrace with command like this:
#    $ gdb --batch --ex "t a a bt" -pid=`pidof evolution` &>bt.txt
# Please check the bt.txt for any private information, like passwords, email address, server addresses,... I usually search for "pass" at least (quotes for clarity only).

------------------------------------------------------------------------------

You can workaround the `alpine` detection by temporarily rename
   ~/mail
and
   ~/.addressbook
into different folder names, in which case the evolution pine importer will not detect the content and will skip the whole 'Import files' page.

Comment 2 Aaron Lu 2016-11-30 02:01:53 UTC
There are two things we are done differently:
1 I do not have pine installed
[aaron@aaronlu ~]$ rpm -qa |grep pine
pinentry-gnome3-0.9.7-2.fc24.x86_64
pinentry-0.9.7-2.fc24.x86_64
2 I always unchecked both the "Mail" and the "Address Book" checkbox(since I do not have anything to import).

Can you remove alpine and try this instead?
In the meantime, I'll see if I can get anything from the console as you suggested.

And yes, I'm running Wayland session but I don't think it affects things(I can verify later).

Some ideas hit my brain... The account type I'm setting up is: Exchange Web Services. I wondered if this played an role so I just tried to set up an IMAP account and the import step finished instantly without blocking. So looks like this is related to the account type, specifically, it's EWS type that has problems.

Comment 3 Aaron Lu 2016-11-30 02:30:10 UTC
Created attachment 1226097 [details]
backtrace retrieved when evolution is frozen

When evolution is frozen in the "import pine(where I unchecked both checkboxes so it shouldn't be importing anything)" dialog, I issued the following suggested cmd to get the backtrace:
gdb --batch --ex "t a a bt" -pid=`pidof evolution` &>bt.txt

Comment 4 Milan Crha 2016-11-30 18:47:31 UTC
Thanks for the update. I still cannot reproduce it myself. Your screenshot shows both options checked, thus I tried with it, but even with both unchecked I do not face of the freeze. Nonetheless the backtrace helps, it shows a deadlock which I tried to address with below commits. I also created a corresponding upstream bug report against glib2 [3].

I also built a test package with the change included for you [4]. Just click on the architecture you use and download the evolution-ews package. Afterwards, as root, update the package (dnf update ./evolution-ews-*.rpm). Then restart the machine, thus also background processes will use the new package.

Please, let me know whether it helped. Thanks in advance.

Created commit 9b73c56 in ews master (3.23.3+) [1]
Created commit 28ddc27 in ews gnome-3-22 (3.22.3+) [2]

[1] https://git.gnome.org/browse/evolution-ews/commit/?id=9b73c56
[2] https://git.gnome.org/browse/evolution-ews/commit/?id=28ddc27
[3] https://bugzilla.gnome.org/show_bug.cgi?id=775422
[4] http://koji.fedoraproject.org/koji/taskinfo?taskID=16684056

Comment 5 Aaron Lu 2016-12-01 02:44:56 UTC
(In reply to Milan Crha from comment #4)
> Thanks for the update. I still cannot reproduce it myself. Your screenshot
> shows both options checked, thus I tried with it, but even with both

Err... I must have forgotten to uncheck them, sorry for the confusion.

> unchecked I do not face of the freeze. Nonetheless the backtrace helps, it
> shows a deadlock which I tried to address with below commits. I also created
> a corresponding upstream bug report against glib2 [3].
> 
> I also built a test package with the change included for you [4]. Just click
> on the architecture you use and download the evolution-ews package.
> Afterwards, as root, update the package (dnf update ./evolution-ews-*.rpm).
> Then restart the machine, thus also background processes will use the new
> package.
> 
> Please, let me know whether it helped. Thanks in advance.

Works for me, thanks for the quick fix!

Comment 6 Milan Crha 2016-12-01 08:35:54 UTC
(In reply to Aaron Lu from comment #5)
> Works for me, thanks for the quick fix!

Nice, thanks for the confirmation.