Comment #23 on issue 5707 by
lukas.fr...@gmail.com: IMAP PUSH not working
I have also problems with push - here my tests I did:
K9 4.801 on Nexus 5 with Cyanogenmod 11, Android 4.4.1:
-------------------------------------
K9 is configured for 3 EMail accounts:
imap.gmail.com,
outlook.office365.com and the mail account of my university.
-------------------------------------
Push/Pull settings for all 3 accounts:
No Pull,
Push only 1st class folders (only the inboxes of the 3 accounts are set as
1st class)
Push refresh every 6 minutes (reduced it for the test - normally i have
24min)
No Pull on push refresh (for testing, to make sure I get only push mail).
-------------------------------------
Test Case:
K9 debug enabled.
Recording the logcat output of K9 for 1 hour with Android Studio - filtered
by "k9" (I saw the instructions at
https://github.com/k9mail/k-9/wiki/LoggingErrors after I was done - I
checked everything again without a filter and there were no AndroidRuntime
errors).
I have a script on a server running which sends a test email to all three
accounts every 15min.
The phone is connected over my home WLAN to the internet. (definitely no
connection interrupts durring the test)
The phone is configured to keep WIFI turned on durring sleep.
Durring the test, the phone was the only IMAP Client connected to these
accounts.
-------------------------------------
Results:
University email:
Note: My university is running a Dovecot server which sends [OK, Still
here] every 2min when idling.
Push works perfectly. I get every mail a few seconds after it is sent.
---
Office 365 email:
Push works sometimes. If the "push refresh rate" is lower it works more
often.
Even though "Pull on push" is disabled I get sometimes multiple emails at
once (I got three emails at the same time even tough they were sent in
15min intervals).
---
Gmail:
Works even less often than Office365.
---
The GMAil and Office 365 account produce this exception every 20-25min each
(pull refresh is still 6min):
12-09 12:11:00.560 4332-13494/com.fsck.k9 E/k9? Got exception while
idling for MAILBOX:INBOX/Thread-425
java.net.SocketTimeoutException: Read timed out
at com.android.org.conscrypt.NativeCrypto.SSL_read(Native
Method)
at
com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:689)
at java.io.InputStream.read(InputStream.java:162)
at
java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)
at
java.io.BufferedInputStream.read(BufferedInputStream.java:227)
at
com.fsck.k9.mail.filter.PeekableInputStream.peek(PeekableInputStream.java:33)
at
com.fsck.k9.mail.store.ImapResponseParser.readResponse(ImapResponseParser.java:42)
at
com.fsck.k9.mail.store.ImapResponseParser.readResponse(ImapResponseParser.java:29)
at
com.fsck.k9.mail.store.ImapStore$ImapConnection.executeSimpleCommand(ImapStore.java:2832)
at
com.fsck.k9.mail.store.ImapStore$ImapFolder.executeSimpleCommand(ImapStore.java:868)
at
com.fsck.k9.mail.store.ImapStore$ImapFolderPusher$1.run(ImapStore.java:3068)
at java.lang.Thread.run(Thread.java:841)
----
The open IMAP(S) connections of my phone - according to my WLAN router
root@openwrt:~# netstat-nat | grep imap
tcp android.lan:37342 my.university.com:imaps
ESTABLISHED
tcp android.lan:38222 157.56.251.214:imaps
ESTABLISHED
tcp android.lan:55973 wi-in-f108.1e100.net:imaps
ESTABLISHED
-------------------------------------
My interpretation:
For some reason, the connection to GMail and Office 365 times out.
If this happens it takes at least one or two pull refresh cycles untill
push works again.
The push connection to my univerity's mail server works because the server
wakes the phone up every 2min when he sends [OK, still here]. (which is
also not realy good because it uses battery - but I can't change it)
Hope this helps to fix the bug.
Logcat:
http://pastebin.com/9cX8i77v