core icon indicating copy to clipboard operation
core copied to clipboard

Backup process fails when device goes to sleep mode at 1% progress and awakes five seconds later

Open gerryfrancis opened this issue 4 years ago • 1 comments

  • 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 running appears.

  • 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: grafik

  • Logs: deltachat-log-20211103-115749.txt

gerryfrancis avatar Nov 03 '21 11:11 gerryfrancis

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().

Hocuri avatar Nov 15 '21 19:11 Hocuri

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.

link2xt avatar Feb 21 '23 19:02 link2xt

The issue no longer occurs in the latest nightly build from today, thank you! Shall we close here?

gerryfrancis avatar Feb 22 '23 16:02 gerryfrancis

I am pretty sure it is not fixed, as in start_io() still can start the scheduler in the middle of import/export.

link2xt avatar Feb 22 '23 18:02 link2xt

Likely fixed by #4138, but need to double-check

link2xt avatar Mar 19 '23 23:03 link2xt

@link2xt I cannot reproduce the issue anymore, can you confirm? Many thanks!

gerryfrancis avatar May 03 '23 07:05 gerryfrancis

I'd close it, we can always reopen or open a new issue if someone reports similar problems.

link2xt avatar May 05 '23 18:05 link2xt

@link2xt Thanks! :)

gerryfrancis avatar May 05 '23 18:05 gerryfrancis