Mistaken `TimeoutError` package while handling timeouts in `run_with_timeout`

Bug #1972272 reported by Ksawery Dziekoński
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-backup-all
Fix Released
Medium
Ksawery Dziekoński

Bug Description

Whenever a run-action timeout is hit, `run_with_timeout` expects to be thrown a `TimeoutError` from `concurrent.futures`, however the executing worker comes from `asyncio`, causing the exception to unexpectedly fall through.

Example traceback is a result of `gzip` taking too much time to compress a MySQL dump, due to running on a single thread.

Traceback (most recent call last):
  File "/var/lib/jujubackupall/auto_backup.py", line 156, in <module>
    auto_backup.run()
  File "/var/lib/jujubackupall/auto_backup.py", line 130, in run
    backup_results = self.perform_backup()
  File "/var/lib/jujubackupall/auto_backup.py", line 70, in perform_backup
    backup_results = backup_processor.process_backups()
  File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/jujubackupall/process.py", line 101, in process_backups
    controller_processor.backup_models()
  File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/jujubackupall/process.py", line 140, in backup_models
    self.backup_apps(JujuModel(name=model_name, model=model))
  File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/jujubackupall/process.py", line 148, in backup_apps
    self.backup_app(app=app, app_name=app_name, charm_name=charm_name, model_name=model_name)
  File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/jujubackupall/process.py", line 155, in backup_app
    charm_backup_instance.backup()
  File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/jujubackupall/backup.py", line 83, in backup
    action_output = check_output_unit_action(self.unit, self.backup_action_name)
  File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/jujubackupall/utils.py", line 95, in check_output_unit_action
    run_with_timeout(backup_action.wait(), action_name)
  File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/jujubackupall/utils.py", line 141, in run_with_timeout
    return run_async(wait_for(coroutine, timeout))
  File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/loop.py", line 38, in run
    raise task.exception()
  File "/usr/lib/python3.8/asyncio/tasks.py", line 501, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

Related branches

Alvaro Uria (aluria)
Changed in juju-backup-all:
status: New → Fix Released
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.