NeoApplications / Neo-Backup

backup manager for android
GNU Affero General Public License v3.0
2.63k stars 127 forks source link

[Bug] Multiple backups are running at the same time #350

Open MartinX3 opened 3 years ago

MartinX3 commented 3 years ago

Description It is possible to run multiple backups at the same time in parallel which will slow down the entire process.

Steps To Reproduce

  1. Start a manual backup of several apps.
  2. While the backup is running, a scheduled backup starts.
  3. Now 2 backups are running in parallel.

Expected behavior The timed backup should wait, until the currently running backup process is complete.

Screenshots N/A

System Information(please complete the following information):

DJCrashdummy commented 3 years ago

in my case 2 scheduled backups ran parallel and even worse: each of them created their own folder for every app (resulting in <appid> & <appid> (1)).

hg42 commented 2 years ago

<appid> & <appid> (1)

that's an SAF problem... it seems to be their (Google's) strategy when a conflict happens. It's totally nonsense/unnecessary, because it's the same folder.

It was one of the reasons, I once added the RootShadow. So if you suffer from this kind of problem you might enable shadowRootFileForSAF and allowShadowingDefault

hg42 commented 2 years ago

manual backup of several apps

do you mean a batch backup (second tab)?

I can understand what you are thinking. Though it is a personally preference.

E.g. it's questionable, if a timed backup shouldn't have priority, it may be timed for a reason, e.g. because a remote directory is mounted before starting the backup.

The main problem here is, that you are scheduling backups while you are using the device. This is generally a bad idea. By using apps and the device in general (broadcasts and services etc.) they will change files in the middle of a backup and this will create inconsistent backups. So don't do it and everything will work like expected.

Also, manually backing up apps that are also in a schedule (that is scheduled just in the same moment?) sounds a bit weird to me. Why?

hg42 commented 2 years ago

slow down the entire process

I don't think so...at least not "entire"

each package is added to the Android Work Manager, no matter in which sequence you add jobs, the work manager runs only a few (basically depending on number of cores and other work load). All others are queued.

What is slowed down is the manual part, you are waiting for.

When your jobs have to wait for others, I think the schedule already started and queued some jobs before you started your manual batch. Because the jobs are usually run in the sequence they were queued. There is parallelism, and because the jobs take different times to finish this might look a bit shuffled. But the start times of the jobs should be sorted (I think the work manager does not guaranty a sequence, but it always was like this for me).

What you are requesting is a priority for everything you are doing manually.

This includes that running jobs from a schedule should even be killed (literally) and your jobs inserted in front of the queue instead. In case a scheduled job would take minutes (which can easily happen for some apps with big data), you are not willing to wait for it, so it must be killed.

So, this is a second reason, why you shouldn't schedule jobs while you are using the device. Either the schedule is disturbing you, or you are disturbing the schedule.