novoda / download-manager

A library that handles long-running downloads, handling the network interactions and retrying downloads automatically after failures
Apache License 2.0
483 stars 63 forks source link

Download manager can't properly restore if one of the download fails #457

Closed Lingviston closed 5 years ago

Lingviston commented 6 years ago

Steps to reproduce:

  1. Install simple app;
  2. Connect device through the proxy server. I used Charles Proxy;
  3. Using proxy tool apply the following rewrite rule 20mb_404_fail.zip. It is for Charles. It makes 404 http error to be returned on each request to 20 mb file.
  4. Launch simple app and start downloading;
  5. Observe batch 1 starts downloading, while batch 2 is queued;
  6. Force stop the app through the device settings menu;
  7. Launch it again and go to downloads screen.

Expected: Download queue restored and actual download statuses are displayed. Actual: Sometimes download queue doesn't restore properly, no statuses are displayed, impossible to start downloads again.

Notice, that error behavior may not reproduce on the first try and you may need to force stop and restart app again.

While investigating this bug I found out that download queue actually gets restored on app restart i.e. downloadBatchMap is getting filled with correct data. But executor inside LiteDownloadManager or LiteDownloadManagerDownloader just gets stuck and all submit calls just hang in its queue forever.

UPDATE Found in release branch (efecb182c7c9f849f5d6a3e938a293c837ded03a). Can't reproduce in develop or latest release.

Mecharyry commented 5 years ago

Can't reproduce in develop or latest release.

Closing. If it still occurs, feel free to reopen.