K9 6.0 randomly stops background sync

I’m a long time K9 user, but recently I have the issue that mails do not arrive. Only when I open K9 it seems to synchronize. I haven’t changed settings. K9 is still excluded from power saving and set to “always” for synchronization. I know this was an issue for many in the past, but it was always working for me.
I’ve 5 mail accounts: 3 IMAP push, 1 IMAP check every 24h and 1 IMAP manual check.
(Pixel 3, Android 12, K9 6.000)

Hi, can you check if your background data usage is restricted for K9?

Thanks for the hint, I’ve checked now but background data usage is/was allowed.

Any other ideas? In the meantime I upgraded to 6.2, but no change in behavior. It seems to take some time to happen, typically it’s working fine for some hours, but on the next day no mails arrive until I open the app.

I think I am seeing the same thing. I have to manually pull to refresh to get new mail (even opening the app doesn’t sync).
I have a Gmail and an Outlook account, and have just changed them to OAuth2 authentication. Sync worked fine previously (K9 6.200, Android 11)

K9 6.200, Android 11 (custom rom) with 2 Gmail + 2 Yahoo accounts, all with IMAP Push and addtionally 1 of them Pulls every half an hour, and sync is working fine here. I also changed to OAuth just recently when it was implemented, so I can’t imagine that’s the reason for your issues :woman_shrugging:

I have shown again the “waiting for mail” notification which was hidden before. This notification also vanishes when the issue occurs. (not sure if this is important)

That sounds like your rom is killing the bits that are needed for K-9 to listen for email Push. Make sure you have K-9 excluded from battery optimization and allow unrestricted background use of data. Both can be found under your rom Settings - Apps - All Apps - find K-9 and check battery and data categories.
Something is killing the background process, the problem is going to be finding the culprit :woman_shrugging:

Hi Nimueh - it’s excluded from battery optimization and background data are allowed. I haven’t changed these settings in years. I also have no battery optimization app, but maybe some other app is causing issues? (but I’ve nothing special here)

Which mail servive provider(s)? Might be an issue from their side, although it seems to be unprobable if it is different prividers.

What else? Maybe post a debug log where something could be seen. But make sure to check sensible data first.

Hi stphn - I have three mail addresses from my German hoster (1und1), they’re one of the biggest in Germany and were quite reliable in the past. Those are on push. Then I’ve a gmail address I’ve switched now to oauth2 with no push, but a daily pull.
I’ve activated the debug log now.

It happened again, roughly 24h after the last manual pull. I exported the logs, but they contain only entries from after opening K9 again. As the 24h re-occurence seems like it could be related to the 24h pull interval for my gmail address.
Let me disable the gmail sync and see what happens.

1 Like

It does not seem to be connected to the gmail sync, it happens also without. Is there a trick to get the logs? After starting K9 again, I only get “fresh” logs. But if the whole app is closed, most likely they are not of value anyway.

Sorry for pushing, but has anyone an idea how to figure out why k9 is killed?

Still having the same issue…any suggestions?

You could try recording a continuous log by connecting your device to a PC and using the command:

adb logcat > k9-log.txt

You can end logging by pressing CTRL+C.

1 Like

Thanks a lot for the hint! I kept the log running for 14h and luckily the issue reoccured during the night. The logfile is now ~20Mb and I do not know what to look for inside. I knew it was working at time stamp 22:00:00, so I have cut off everything before. When I looked on it the last time, the sync process was gone so I disabled the log. Here is the link to the log:

It looks like K-9 Mail was killed by the system because the web view component was updated.

10-25 23:03:23.896  1920  2057 I ActivityManager: Killing 29169:com.fsck.k9/u0a379 (adj 200): stop com.google.android.webview due to update lib

If you configured the app to use Push there would have been a foreground service running. It feels like a bug in the OS to not automatically restart the service after the web view update has completed.

It looks like Android had this problem before. But it’s marked as fixed. See Google Issue Tracker


Good catch! Thanks for diving into the log. If it’s a general bug, I’m wondering why it seems to be a rare problem. Maybe there is any setting that has an impact.
Regarding the bug tracker - the “Fixed” is quite current and it says “available in a future release” which most likely means not for me on my Pixel 3 without updates.

Just to update:
I had recently replaced my Pixel 3 with a Pixel 5 (with current patch level) and the issue is gone. :slight_smile:

1 Like