thunderbird / thunderbird/thunderbird-android

k9mail silently stopped to sync mails with IMAP, while other clients work.

Open
#4,227 9 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
14k
Forks
2.8k
Avg merge
3d 3h
Merged PRs (30d)
57

Description

I am facing two problems here: The first is that the IMAP synchronization does not work anymore, and the second is that it fails silently, i.e. there is no notification about the error. This is bad because I rely on k9mail to be notified when I receive mails or when there is an error.

Expected behavior

IMAP mail should sync according to the time schedule I set in the settings. If there is a problem, a notification should appear.
Normally, when sync is fired, the status changes to: "Poll Account:Inbox 0/200" and then the 0 is counting up the numbers of new mails in the Inbox.

Actual behavior

The sync is fired periodically like it should. The status hangs a few seconds (around 10 s) on: "Poll Account:Inbox 0/200" an then returns to "Next poll In ... minutes". No new mails are shown. No notification is shown. All other clients show newly arrived mails.
I tried "Clear messages" and "Recreate data". After that, the Inbox was empty. Then, the next sync attempt downloaded 4 old messages and then failed again (silently). Every now and then, a single new mail comes through, but very few do...
The problem began sometime on october 24. Before this, I never had this problem (using k9mail for some years now).
If I switch to the folder view, under the "Inbox" title, there is a grey line saying "NumberFormatException: For".

I then switched on logging and the last entry is an error:

[10-28 13:53:17.798 8020:8040 E/ImapSync] synchronizeMailbox java.lang.NumberFormatException: For input string: "NIL" at java.lang.Integer.parseInt(Integer.java:521) at java.lang.Integer.parseInt(Integer.java:556) at com.fsck.k9.mail.store.imap.ImapList.getNumber(ImapList.java:48) at com.fsck.k9.mail.store.imap.ImapFolder.parseBodyStructure(ImapFolder.java:1028) at com.fsck.k9.mail.store.imap.ImapFolder.parseBodyStructure(ImapFolder.java:981) at com.fsck.k9.mail.store.imap.ImapFolder.handleFetchResponse(ImapFolder.java:885) at com.fsck.k9.mail.store.imap.ImapFolder.fetch(ImapFolder.java:737) at com.fsck.k9.controller.imap.ImapSync.downloadLargeMessages(ImapSync.java:701) at com.fsck.k9.controller.imap.ImapSync.downloadMessages(ImapSync.java:471) at com.fsck.k9.controller.imap.ImapSync.synchronizeMailboxSynchronous(ImapSync.java:258) at com.fsck.k9.controller.imap.ImapSync.sync(ImapSync.java:63) at com.fsck.k9.controller.imap.ImapMessageStore.sync(ImapMessageStore.java:25) at com.fsck.k9.controller.MessagingController.synchronizeMailboxSynchronous(MessagingController.java:742) at com.fsck.k9.controller.MessagingController$9.run(MessagingController.java:726) at com.fsck.k9.controller.MessagingController.runInBackground(MessagingController.java:206) at com.fsck.k9.controller.MessagingController.access$000(MessagingController.java:122) at com.fsck.k9.controller.MessagingController$1.run(MessagingController.java:175) at java.lang.Thread.run(Thread.java:761)

So apparently, k9mail is detecting an error. But why is there no notification about the error? I missed some important mails thinking that no mails arrived... I don't know if I have to file a separate issue for the missing notification...

And could there be a workaround for the problem? Or a fix? As the other clients (Thunderbird, Apple Mail) work, I assume it's a problem of k9mail.

Just FYI, I'm using the davmail Exchange gateway davmail.sourceforge.net but this should not be the problem as all the other clients work like a charm and k9mail did work as well until october 24.

Steps to reproduce
  1. Configure an IMAP account in k9mail.
  2. Hit "Check mail".
  3. No (or not all) new mails are synced.
  4. No notification is shown.
Environment

K-9 Mail version: 5.600

Android version: 7.1.2

Account type: IMAP (davmail)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack-trace entry points in mail/store/imap/ImapList.java, mail/store/imap/ImapFolder.java, and controller/imap/ImapSync.java, then trace how the synchronization failure is surfaced to notifications. Reproduce the IMAP sync failure with the reported davmail setup; done means the affected messages sync reliably and an error notification appears when synchronization fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
mobile-dev, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.