Skip to content

Commit

Permalink
ota_core: handle download stalls timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang committed Nov 30, 2024
1 parent 3bbc393 commit b308043
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/otaclient/ota_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@
DownloadPoolWatchdogFuncContext,
)
from otaclient_common.persist_file_handling import PersistFilesHandler
from otaclient_common.retry_task_map import ThreadPoolExecutorWithRetry
from otaclient_common.retry_task_map import (
TasksEnsureFailed,
ThreadPoolExecutorWithRetry,
)

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -532,6 +535,11 @@ def _execute_update(self):
# NOTE(20240705): download_files raises OTA Error directly, no need to capture exc here
try:
self._download_files(otameta, delta_bundle.get_download_list())
except TasksEnsureFailed:
# NOTE: the only cause of a TaskEnsureFailed being raised is the download_watchdog timeout.
_err_msg = f"download stalls longer than {cfg.DOWNLOAD_INACTIVE_TIMEOUT}, abort OTA"
logger.error(_err_msg)
raise ota_errors.NetworkError(_err_msg, module=__name__) from None
finally:
del delta_bundle
self._downloader_pool.shutdown()
Expand Down

0 comments on commit b308043

Please sign in to comment.