Backup process fails when device goes to sleep mode at 1% progress and awakes five seconds later
-
Android version: Android 11.
-
Device: Fairphone FP2 (Lineage OS 18.1 build RQ3A.210705.001 from 2021-10-29).
-
Delta Chat version: 1.23.0 (latest nightly build).
-
Expected behavior: The backup process continues when the device awakes from sleep mode.
-
Actual behavior: The backup process is aborted after the device awakes from sleep mode, namely at 1% of the progress, and the message
cannot export backup, IO already runningappears. -
Steps to reproduce the problem: -- Start a backup ("Settings" -> "Chats and Media" -> "Back Up Chats to External Storage" -> "Start Backup"). -- Immediately after the backup process has started, put the device in sleep mode by using the power switch. -- Wait five seconds. -- Awake the device from sleep mode by using the power switch and go back to Delta Chat, then wait 30 seconds. (Result: The backup process is aborted.)
-
Screenshots:

Seems like the problem is that during the backup, ForegroundDetector does startIo().
We should somehow prevent starting IO during IMEX operations (and probably also during configure). This could somehow be integrated into alloc_ongoing().
Context.start_io() should refuse to create a Scheduler if there is an ongoing process.
Ideally InnerContext.scheduler variable should become a variant of InnerContext.running_state enum, so it is impossible to have an ongoing process and running scheduler on a type system level.
It is also important for #4007 that we cannot start the scheduler while serving a backup.
The issue no longer occurs in the latest nightly build from today, thank you! Shall we close here?
I am pretty sure it is not fixed, as in start_io() still can start the scheduler in the middle of import/export.
Likely fixed by #4138, but need to double-check
@link2xt I cannot reproduce the issue anymore, can you confirm? Many thanks!
I'd close it, we can always reopen or open a new issue if someone reports similar problems.
@link2xt Thanks! :)