Bug 1717387 - Evolution not picking up new mail on resume
Summary: Evolution not picking up new mail on resume
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: evolution
Version: 30
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Milan Crha
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-06-05 11:42 UTC by Bojan Smojver
Modified: 2019-06-18 14:53 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-07 13:08:12 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Bojan Smojver 2019-06-05 11:42:27 UTC
Description of problem:
It appears that Evo may have regressed a bit and when I resume my laptop, new messages are not picked up by NOTIFY from Dovecot (F30, 2.3.6). If I manually refresh, NOTIFY starts working again and any new message from that point on will be automatically picked up.

Version-Release number of selected component (if applicable):
evolution-3.32.2-1.fc30.x86_64

How reproducible:
Almost always.

Steps to Reproduce:
1. Have Evo open to Dovecot.
2. Suspend laptop.
3. Resume and see whether new mail shows up - it doesn't.

Actual results:
Mail received since suspend not automatically picked up when laptop is resumed and network connected.

Expected results:
Worked before.

Additional info:
No idea right now whether this is really an Evo bug or maybe something else not delivering necessary signals to Evo to reconnect and wait for new mail with NOTIFY. My receiving options are check all folders, use quick resync, listen to server change notification (been like this for may Fedora upgrades now).

Comment 1 Milan Crha 2019-06-07 13:08:12 UTC
Thanks for a bug report. The resume from suspend doesn't always trigger reconnect of the configured mail accounts when the network is reachable again. The is done either when a user moves between mail folders in Evolution or does some other work which would require the account being connected, or when the new mail check timeout elapses, which may or may not be enabled in the Receiving Options of the respective account.

I moved this upstream as [1]. Please see it for any further updates.

[1] https://gitlab.gnome.org/GNOME/evolution/issues/479

Comment 2 Milan Crha 2019-06-11 19:08:04 UTC
I see you are not on the upstream bug report, thus I'll ask here:

Beside the account name is shown an icon whether the account is connected or not. I tested it here, just by going online/offline in Evolution, and the account is connected when the host can be reached. There was one little issue with it for offline stores, but in case of IMAP it always runs also NOOP after it is connected, thus there is running an idle thread, which is responsible to receive the notifications (both for NOTIFY and for IDLE).

The thing is that the NOTIFY notifies about newly received messages sine the NOTIFY had been enabled, it does not notify about messages which are already received. That would require similar refresh as is done after start of Evolution (when "Edit->Preferences->Mail Preferences->General tab->Start up section at the top->Check for new mesages on start" option is set), also after the account is connected. I think it can be done, especially when it's tight to this option as well.

Could you confirm that my understanding is correct, please?

I'll create something meanwhile and provide a test package for the change as outlined above.

Comment 3 Milan Crha 2019-06-11 20:36:37 UTC
Here [1] is a test build, which contains proposed upstream patch from [2], which also contains a little description of how it works.

Could you give it a try and report back, please?

[1] https://koji.fedoraproject.org/koji/taskinfo?taskID=35488768
[2] https://gitlab.gnome.org/GNOME/evolution/issues/479#note_529491

Comment 4 Bojan Smojver 2019-06-11 21:47:25 UTC
Thanks for the very quick turnaround. I will test the new build soon.

I thought I did turn on notifications in Gnome Gitlab for this bug. I did receive the patch in my email. I am not a big Gitlab user, so maybe I did something stupid there.

Comment 5 Milan Crha 2019-06-12 10:58:22 UTC
(In reply to Bojan Smojver from comment #4)
> I thought I did turn on notifications in Gnome Gitlab for this bug. I did
> receive the patch in my email. I am not a big Gitlab user, so maybe I did
> something stupid there.

Aha, I see. I thought that the Participants list matches those with Notifications on, but it seems it means those whom wrote a comment, not also those whom "are listening" (I'd expect the "Participants" being like "CC List" here). I'm also new to GitLab. I'm sorry for confusion.

Comment 6 Bojan Smojver 2019-06-12 11:09:27 UTC
I don't think the patch worked. I resumed my laptop and there was mail in one of the folders that was unread, but nothing was picked up by Evo.

Comment 7 Milan Crha 2019-06-12 11:32:11 UTC
(In reply to Bojan Smojver from comment #0)
> My receiving options are check all folders, use quick resync,
> listen to server change notification (been like this for may Fedora upgrades
> now).

Is in the Receiving Options set to "Check for new messages every XXX minutes"? And in the Preferences that "Check for new messages after start", eventually the option below it? The "check all folders" on its own doesn't do anything.

Comment 8 Bojan Smojver 2019-06-12 12:00:23 UTC
The option to check every X minutes is not set (i.e. only IMAP NOTIFY should do it, if I'm understanding this correctly - no polling). In mail preference, both the option to check on start and to check messages in all active accounts is set.

I also just updated my F30 with latest updates from testing. There were some glib2 updates there with something about network status detection. Let me try one more time and report back.

Comment 9 Milan Crha 2019-06-12 12:15:50 UTC
(In reply to Bojan Smojver from comment #8)
> The option to check every X minutes is not set (i.e. only IMAP NOTIFY should
> do it, if I'm understanding this correctly - no polling).

Correct.

> In mail preference, both the option to check on start and to check messages
> in all active accounts is set.

That should make the refresh. I'll test it here, because I had a little different settings here when testing the proposed patch.

Comment 10 Milan Crha 2019-06-12 12:27:00 UTC
(In reply to Milan Crha from comment #9)
> I'll test it here, because I had a little different settings here when testing the proposed patch.

I'm still testing this by moving evolution to offline and then online, rather than full resume from suspend, and the proposed patch works fine in this scenario.

I agree with you that the resume from suspend is more complicated, especially with the network connection. That might be the reason for it to fail. Does Evolution recognize that the machine was offline after you resume from suspend? There may flash an information about it. If you run evolution from a terminal, it'll show there messages about forced online/offline state too.

Comment 11 Bojan Smojver 2019-06-12 12:54:50 UTC
I will do some more testing on that tomorrow and let you know.

Comment 12 Bojan Smojver 2019-06-12 13:01:26 UTC
So, the email that I sent to myself from another account that landed in the inbox was not shown by Evo on resume. However, your updates to this bug that normally land in another folder did show up later. In other words, notify worked, but the initial resync did not.

I will test more tomorrow.

Comment 13 Milan Crha 2019-06-12 19:39:28 UTC
I just noticed that Network Manager reports connection available when I disconnect from the wired connection and turn off WiFi. That means that evolution doesn't know it's offline, thus it doesn't trigger the code I added in the patch. The 'netlink' implementation notices that properly. (You can change the type of the connection checker in Edit->Preferences->Network Preferences.

There can be related other details as well, like when the account is hidden behind VPN, which is not connected after resume from suspend. After connecting the VPN the account doesn't refresh like it would do when whole evolution goes online.

Here [1] is an extended patch, with added debug prints. When you run evolution from a terminal you'll see what it does in the background after the Evolution goes online.

[1] https://koji.fedoraproject.org/koji/taskinfo?taskID=35508698

Comment 14 Milan Crha 2019-06-13 06:58:58 UTC
I forgot to mention, as a side test, you can switch Evolution to offline (File->Work offline) and when you switch it to online (File->Work online), then the update will be done as expected (as long as the account will be able to reach the server).

I believe what you face is a variant of the missed online/offline state change during suspend/resume and/or a variant of the VPN case I mentioned in my previous comment. I will focus on this.

Comment 15 Bojan Smojver 2019-06-13 10:43:52 UTC
Installed the latest build and started Evo from the command line and redirected stdout/stderr to log. Then I sent myself an email from another account. The log had:

evolution-shell-Message: 20:31:29.675: Network disconnected.  Forced offline.
evolution-shell-Message: 20:32:56.738: Connection established.  Going online.

However, there was nothing shown as new in the inbox. Dovecot logs around suspend/resume, if they matter:

Jun 13 20:26:23 <host> dovecot[869]: imap(user)<1316><XXXXXXXXXXXXXXXX>: Connection closed (IDLE finished 318.538 secs ago) in=752 out=53676 deleted=0 expunged=0 trashed=5 hdr_count=0 hdr_bytes=0 body_count=1 body_bytes=49957
Jun 13 20:31:09 <host> dovecot[869]: imap-login: Login: user=<user>, method=GSSAPI, rip=<client-ip>, lip=<server-ip>, mpid=1361, TLS, session=<XXXXXXXXXXXXXXXX>
Jun 13 20:31:29 <host> dovecot[869]: imap(user)<1361><XXXXXXXXXXXXXXXX>: Connection closed (IDLE finished 16.579 secs ago) in=2560 out=10562 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
Jun 13 20:33:11 <host> dovecot[869]: imap-login: Login: user=<user>, method=GSSAPI, rip=<client-ip>, lip=<server-ip>, mpid=1378, TLS, session=<XXXXXXXXXXXXXXXX>

PS. I went to my other folder where I keep RH bugs to respond here. The moment I clicked back on the inbox, the new email showed up, of course.

Comment 16 Milan Crha 2019-06-13 12:14:31 UTC
> evolution-shell-Message: 20:31:29.675: Network disconnected.  Forced offline.
> evolution-shell-Message: 20:32:56.738: Connection established.  Going online.

Good it catches the online changes. Bad it doesn't do anything from the debug prints. It is supposed to print things also whenever Send/Receive is clicked, but I see there an output shortly after the "Going online" message is printed here (the delay depends on how long it'll take to the account to connect to the server).

Comment 17 Bojan Smojver 2019-06-14 00:34:45 UTC
I didn't use send/receive on purpose, because the idea was to let Evo pick the mail up without my intervention. I can rerun the test with send/receive, but I already know this will pick new mail up.

I do not have vpn here, so just plain old wired ethernet is in use.

Comment 18 Milan Crha 2019-06-14 08:52:32 UTC
I meant the Send/Receive as a way to test that the refresh will find the new messages, but you are right, it may just work.

I made some upstream changes and committed them. They are in these two packages [1][2]. Would you mind to give it a try, please? There's planned a release on Monday, which will include them both, thus if you'd find any issue with it, then it could be fixed before the release. If not, then no problem, it'll get to a following release(s).

[1] https://koji.fedoraproject.org/koji/taskinfo?taskID=35534161
[2] https://koji.fedoraproject.org/koji/taskinfo?taskID=35535619

Comment 19 Bojan Smojver 2019-06-14 09:30:28 UTC
Yay! It works. Thank you!

Comment 20 Milan Crha 2019-06-14 09:39:56 UTC
Nice. Thanks for a quit test and confirmation.

Comment 21 Bojan Smojver 2019-06-18 11:03:38 UTC
I am not sure whether this is in any way related, but today Evo (latest scratch build above) failed to detect that network came online after resume (i.e. possibly a different issue). I could see that the icon next to my account didn't have two opposing arrows. Just FYI.

I upgraded to official release now from updates-testing and I will let you know how it goes.

Comment 22 Milan Crha 2019-06-18 14:53:43 UTC
It might not be related, these state changes depend on the way glib2 reports it to the Evolution (through GNetworkMonitor). You can try to change the way Evolution detects online/offline changes in Edit->Preferences->Network Preferences, where the "inet" backend (sometimes) works better than the "networkmanager".


Note You need to log in before you can comment on or make changes to this bug.