Bug report: Huge delay for new messages

On several Android devices, no notification for new messages is displayed (unless the app is opened first) for several hours, even though battery optimization for DC is disabled.
On one device, a mailing app is installed (FairEmail), surveilling the account also used with DC. This app takes notice of new DC messages (including display confirmations) and shows respective notifications.
Only after opening the DC app manually, the mails are moved to the DC folder and shown as unread/new messages.

Can you provide more information to debug this?

  • comparison of energy usage between the mailing app and deltachat
  • deltachat log/s of that period (make sure to censor/redact secrets and/or send it to us via PM or delta( at )merlinux.eu
  • Model, OS version and DC version of the android devices that were used
  • does it work correctly if fairmail isn’t active / used? (to be sure its not some email server quirk, prefering one app over the other)

Absolutely:

FairEmail is using about 3-4 times the amount of battery compared to DC. However this is not unlikely since I use FairEmail actively sometimes and DC rarely.

Devices: Google Pixel 4a and two different Samsung Galaxy S3s (2017)

OS: Android 11 (Stock), Android 8 (Samsung), Lineage 17.1

The behavior is the same regardless whether FairEmail ist running or not.

I’ll try to provide logs later.

Is there a way on your phone to distinguish between foreground and background battery usage?

Maybe there are more steps necessary for your particular device, look on https://dontkillmyapp.com/ and try the persistent notification option in the deltachat android settings (though I don’t know how exactly its called in there as I don’t use android that much)

1 Like

I assume the persistent notification option is the setting that enables showing the status bar icon at all times (and is titled “Zuverlässige Hintergrundverbindung” in German), right? If so, would this continue to work when I disable the icon in the notification settings while keeping the option in DC active? Activating a permanent icon would not be an acceptable option for me.

As for the battery usage, it is not differenciated between fore- and background. BUT it does show the following interesting statistics, e.g. my current values:

DeltaChat:
Battery usage 2%
Active usage 7 minutes
Background activity 1 hour and 34 minutes

FairEmail:
Battery usage 8%
Active usage 1 day and 7 hours
Background activity 0 minutes

It seems that FairEmail manages to stay active even after I close the app. (My actual foreground usage was definitely less than an hour.)
DeltaChat seems to “deep sleep” most of the time, very likely causing my issue, at least on this device.
I will keep an eye on these values now with the persistent background notification enabled

Yes.

I don’t know, but @adbenitez @Hocuri @r10s could know the answer.

We don’t know, but I personally think yes it will continue to work. If you try it out, please tell us whether it worked! (and in 3 months whether it still works) (this is a really important information, because we might add a hint for users to do this, but only if we are sure it works)

1 Like

I can confirm that it works this way, at least according to the battery usage statistic. Since I enabled the “persistent” option (and disabled the icon as described), the background activity remains unchanged, while the foreground activity is now at over 20 hours - meanwhile, the app was only opened for a few minutes total.
Interestingly and to my relief, the battery usage shown for DC has only risen by a single percentage point compared to before.
I will keep an eye on these values, but it is such strong an indication that I would accept pretty much any bet with someone saying otherwise :wink:
The next testing step for me will be watching message receipt times with these settings.

1 Like

I don’t know if there is a connection, but now I am facing the problem that some messages (and receipt confirmations) are not recognized by DC at all and instead remain in the general inbox folder, even AFTER opening the DC app and waiting a while. It’s like the client stopped working altogether.

Look into the DC logs, there are probably some clues in there.

The log is pretty long. Anything specific I should look for?
The keywords “error” and “fail” only appear once each and I don’t really know what to make of this:
07-11 20:46:17.861 22772 22813 W DeltaChat: src/scheduler.rs:190: io: Connection reset by peer (os error 104)
07-11 20:46:17.861 22772 22813 W DeltaChat: src/imap.rs:397: failed to close folder: NoSession

The only keyword you can filter for is DeltaChat, if you filter by something else you will miss things. And you could look at only the timespan when the message should have arrived. But often only developers can make sense of the log, so you could anonymize and post it here.

@Teo
“reliable background connection” with the permanent notification is absolutely necessary to keep DC running and to receive new messages instantly.
I’m did much research around that and this is my experience on a S3 mini with Android 4.

When you do not have the permanent notification enabled Android kills sooner or later (more sooner) DC and you’ll not get new messages.

Maybe you can examine DC’s logfile. Here you can see if there are entries permanently over the time. This indicates DC is running.

Maybe this assists you in using DC

1 Like

Problem is definitely not solved, even with persistence enabled and mailing app disabled.
Just had another Test: Closed the DC app on the receiving client, a minute later sent a message from the other device. Waited for 10 minutes - no notification is displayed at all, until the DC app is manually opened again.
The log does not show any entries for the meantime and only starts again at the time of the manual start.

@Teo
IMHO your observations are really unusual and I think it’s time to check step by step:

Settings–>Notifications:

  1. Notifications => enabled ?
  2. Reliable Background Connection => enabled ?
  3. Priority => standard ?

Settings–>Extended:

  1. IMAP-Settings
    At least “Watch for Inbox” (or similar)

Settings–>Chats and Media:

  1. Show All Emails (enable this to see really all incoming messages)

When DC is in background:

  1. Can you see permanent message “Delta Chat, Background Connection Enabled” (or similar text) ?

When all this is checked with no result maybe you should post more
details about your Android-Version and an anonymized log of DC.

Yes to 1, 2, 4 and 6.
3. Priority is set to high - should have no negative impact?
5. Was set to chats only until now. I will change it to all and test some more.

Ok, so far it should work, but try to see all emails.

The impact of Thread Priority is unclear for me in the moment. Therefore I launched a question related to that here in forum.
For myself I’m using standard. Maybe there is some negative impact if You choose another one? But I don’t know.

Seeing all mails does not help. Notifications are still missing until DC is opened manually.
I have now changed the priority to standard as well, however would be surprised if this made the difference.