Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long running pre-backup commands freeze UI #210

Open
schwma opened this issue Feb 26, 2019 · 9 comments · May be fixed by #2214
Open

Long running pre-backup commands freeze UI #210

schwma opened this issue Feb 26, 2019 · 9 comments · May be fixed by #2214
Labels
good first issue Simple change to start learning code base priority:low Nice to have feature, minor improvement to functionality or usability type:enhancement Improvement of an existing function

Comments

@schwma
Copy link

schwma commented Feb 26, 2019

Describe the bug
I was trying to add a random delay of 0-59 minutes per backup using the pre-backup command option. To do so I used the following command: sleep $[ $RANDOM % 60 ]m, but unfortunately while pre-backup commands are running, the Vorta UI freezes. This probably won't be an issue for most scripts, but will be a problem in cases where scripts take a long time to compete.

To Reproduce
Steps to reproduce the behavior:

  1. Open Vorta -> Schedule -> Shell Commands
  2. Enter a long running command as a Pre-backup command, such as sleep 1m
  3. The Vorta UI will stop responding while the command is running

Desktop (please complete the following information):

  • OS: Ubuntu 18.10
@m3nu
Copy link
Contributor

m3nu commented Feb 26, 2019

Interesting, since the pre/post-backup command runs in its own thread. Will test.

@schwma
Copy link
Author

schwma commented Feb 26, 2019

I just tested the pre-/post-backup commands in Vorta 0.6.10 and only the pre-backup command seems to freeze the UI. I assumed it extends to the post command as well, but it does not.

@schwma schwma changed the title Long running pre-/post-backup commands freeze UI Long running pre-backup commands freeze UI Feb 26, 2019
@m3nu
Copy link
Contributor

m3nu commented Feb 26, 2019

That makes sense actually. The pre-backup command is run when preparing the backup. So it runs in the main thread. (I gave the wrong info just before.)

The reason for this is to allow checking for certain conditions. E.g. the right network. If the returncode is not 0, it will cancel the backup.

I also noticed that the UI only blocks if the backup is started by the user. It doesn't block when the backup is started by the background scheduler.

So I see those options to improve the behavior:

  1. Don't run pre-backup command when user starts backup himself + note about this next to the pre-backup field.
  2. Add logging message that pre-backup command is now running before actually running it. So user knows whats going on. UI will still freeze.
  3. Refactor to run pre-backup command in a separate thread, like the main Borg-command.

@ThomasWaldmann
Copy link
Collaborator

I wouldn't limit pre-backup to "checking conditions". Often this is used to bring the data into a backup-worthy state (like dumping an active database, doing a snapshot, etc.) and this obviously must always run, no matter whether started manually or automatically. So option 1 is out of question.

3 sounds like the best option.

@m3nu
Copy link
Contributor

m3nu commented Feb 27, 2019

3 it is then.

@m3nu m3nu added type:bug Something doesn't work as intended good first issue Simple change to start learning code base labels Feb 27, 2019
@m3nu m3nu added this to the v0.6.12 milestone Mar 6, 2019
@m3nu m3nu removed this from the v0.6.30 milestone May 29, 2020
@m3nu m3nu added priority:low Nice to have feature, minor improvement to functionality or usability type:enhancement Improvement of an existing function and removed type:bug Something doesn't work as intended labels May 29, 2020
@m3nu m3nu self-assigned this Jun 2, 2020
@samuel-w
Copy link
Contributor

They are also uncancellable, while blocking other actions such as repo checking.

@real-yfprojects
Copy link
Collaborator

I would try to have an own PreBackupJob inheriting JobInterface or BorgJob and scheduling the BorgCreateJob in its finished_event method, while BorgCreateJob schedules the PostBackupJob. Though this is not as simple as I described it here since the jobs must run right after each other.

@sunhasgothishaton
Copy link

I have a pre backup script which takes a few minutes. It took me a while to realise that the UI had froze, without any notification that it was running.

I know in the long term it would be good to implement option 3. Would it be possible, for the short term, to implement option 2 as this would allow me (and other users) to see that the backup (and pre backup script) is running, while the UI is frozen.

@ahmedhosssam
Copy link

Hi,
I'm working on this issue right now.

@ahmedhosssam ahmedhosssam linked a pull request Mar 8, 2025 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Simple change to start learning code base priority:low Nice to have feature, minor improvement to functionality or usability type:enhancement Improvement of an existing function
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants