Skip to content

IDLE keepalives are not sent frequently enough on Android when the app is suspended #6533

Open

Description

@link2xt

Delta Chat attempts to interrupt IDLE every 5 minutes:
https://github.com/deltachat/deltachat-core-rust/blob/81e9628ab79941adaa12de1e30cefb8d8d69b3f9/src/imap/idle.rs#L14-L20

However, this does not seem to happen because monotonic clock used almost everywhere does not advance when the app is suspended and boottime clocks which should be used instead are not available in Rust yet:

FairEmail apparently does not have such problems, but it is using Java APIs everywhere:
#6532 (comment)

The bug can be worked around by reducing imap_idle_notify_interval in Dovecot, but we need a fix on the client side:
#6532 (comment)

Activity

  1. DarkCat09 commented on Apr 12, 2026

    @DarkCat09
    Contributor

    Made a quick demo: https://git.dc09.xyz/DarkCat09/timers-suspend-test

    Same applies for any Linux system (not sure about all POSIX), this should be fixed not only for Android.
    I think i've encountered this bug on my DeltaChat Desktop at least once.

  2. DarkCat09 commented on Apr 12, 2026

    @DarkCat09
    Contributor

    Can we bring systime crate as a dependency or it would be better to write smth more minimal?
    Or you'd prefer to wait for the implementation in rust std -> in tokio, and then use it in async-imap?

  3. DarkCat09 commented on Apr 12, 2026

    @DarkCat09
    Contributor

    I suggest moving the issue to async-imap repo

  4. link2xt commented on Apr 15, 2026

    @link2xt
    CollaboratorAuthor

    systime looks good, except that it does not have https://docs.rs/tokio/latest/tokio/time/fn.timeout.html so will have to use sleep and race against it instead, ideally in a custom timeout function.

    As for moving this to async-imap: maybe a better way is to add API to https://github.com/chatmail/core/blob/main/src/imap/idle.rs that can run without timeout at all and then interrupt it manually from chatmail/core? So we don't introduce a dependency into async-imap.

    We also have the same problem with disappearing message timers (ephemeral.rs), could use better sleep/timeout in most places.

  5. DarkCat09 commented on May 2, 2026

    @DarkCat09
    Contributor

    I mean, when/if boottime gets implemented in Rust std, all networking libraries should switch to it, including our async-imap.

    Also, if needed, i can write a more minimal version of systime as a separate crate and add a tokio-like timeout() there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions