App freezes for a longer time after a download #433

Closed
opened 2026-04-24 23:22:55 +02:00 by adam · 6 comments
Owner

Originally created by @lukeIam on GitHub (Feb 4, 2023).

Steps to reproduce

  1. Download an audio book with many mp3 files (e.g. ~500MB 232 Tacks or ~500MB 275 Tacks)
  2. Wait till the download reaches 100%
  3. App freezes for 5-9 min (I did multiple tries with different books)
    (A currently playing book continues to play, but the UI is completely frozen + android shows the "wait or kill" message after some time
  4. Wait the 5-9 min and see the successfully imported notification
  5. offline book works fine after waiting

Expected behaviour

  • The ui should not freeze at all (background process?)
  • The import should be faster for 500MB (but the secondary)

Actual behaviour

  • App UI freezes for 5-9 min
  • Android shows the "wait or kill" message
  • If you change out of the app and come back the screen is not updated

Environment data

Audiobookshelf Version: v2.2.14 (also with the version before)
Audiobookshelf App: 0.9.61-beta

  • Android App?

Android Issue

Android version: 12

Device model: Poco X3 NFC
(8 GB RAM, Octa core Snapdragon 732G)

Stock or customized system:
stock (MUUI 13.0.4 stable global)

Originally created by @lukeIam on GitHub (Feb 4, 2023). ### Steps to reproduce 1. Download an audio book with many mp3 files (e.g. ~500MB 232 Tacks or ~500MB 275 Tacks) 2. Wait till the download reaches 100% 3. App freezes for 5-9 min (I did multiple tries with different books) (A currently playing book continues to play, but the UI is completely frozen + android shows the "wait or kill" message after some time 4. Wait the 5-9 min and see the successfully imported notification 5. offline book works fine after waiting ### Expected behaviour - The ui should not freeze at all (background process?) - The import should be faster for 500MB (but the secondary) ### Actual behaviour - App UI freezes for 5-9 min - Android shows the "wait or kill" message - If you change out of the app and come back the screen is not updated ### Environment data Audiobookshelf Version: v2.2.14 (also with the version before) Audiobookshelf App: 0.9.61-beta - [x] Android App? #### Android Issue Android version: 12 Device model: Poco X3 NFC (8 GB RAM, Octa core Snapdragon 732G) Stock or customized system: stock (MUUI 13.0.4 stable global)
adam added the bug label 2026-04-24 23:22:55 +02:00
adam closed this issue 2026-04-24 23:22:56 +02:00
Author
Owner

@lukeIam commented on GitHub (Feb 4, 2023):

addition: if the app is killed while it is freezed the book is half registered - its not showing up as offline and not showing up in the "Local Library Items" menu. But if I click (force) re-scan the notification shows a number including the book in question.
But also after the rescan it not showing up anywhere.

@lukeIam commented on GitHub (Feb 4, 2023): addition: if the app is killed while it is freezed the book is half registered - its not showing up as offline and not showing up in the "Local Library Items" menu. But if I click (force) re-scan the notification shows a number including the book in question. But also after the rescan it not showing up anywhere.
Author
Owner

@kebbe commented on GitHub (Feb 4, 2023):

Same behavior here, started with 0.9.61 beta
Pixel 6

@kebbe commented on GitHub (Feb 4, 2023): Same behavior here, started with 0.9.61 beta Pixel 6
Author
Owner

@advplyr commented on GitHub (Feb 4, 2023):

Thanks, I'll look into this.

Just to give some more context on how downloading works for anyone interested..

The downloaded files are being downloaded to storage allocated for the app. That is a folder only the app has access to.

After a file is downloaded successfully it is moved to the folder you selected.

The app is using DownloadManager, the built-in Android download API, and it is not allowing downloads directly to "public" folders. That is why I built it to first download to app storage then move to public storage.

After all files are successfully downloaded & moved they are put in a LocalLibraryItem object and stored in the db. The LocalLibraryItem is essentially the same as a LibraryItem from the server except it has additional fields like the server connection it belongs to, the local device paths, etc.

From the description of the issue I believe it is the final step of building the LocalLibraryItem that is taking so long.

@advplyr commented on GitHub (Feb 4, 2023): Thanks, I'll look into this. Just to give some more context on how downloading works for anyone interested.. The downloaded files are being downloaded to storage allocated for the app. That is a folder only the app has access to. After a file is downloaded successfully it is moved to the folder you selected. The app is using DownloadManager, the built-in Android download API, and it is not allowing downloads directly to "public" folders. That is why I built it to first download to app storage then move to public storage. After all files are successfully downloaded & moved they are put in a `LocalLibraryItem` object and stored in the db. The `LocalLibraryItem` is essentially the same as a `LibraryItem` from the server except it has additional fields like the server connection it belongs to, the local device paths, etc. From the description of the issue I believe it is the final step of building the `LocalLibraryItem` that is taking so long.
Author
Owner

@advplyr commented on GitHub (Feb 4, 2023):

I was able to reproduce this. Not quite as long as you are saying, but it was taking 1 - 2 minutes to process the files after download.

I'm not sure why that part takes that long but I was able to move that off the main thread so it doesn't freeze the UI. I also updated the text on the audiobook page to say "Download complete. Processing..." instead of it looking like it is stuck at 100%.

@advplyr commented on GitHub (Feb 4, 2023): I was able to reproduce this. Not quite as long as you are saying, but it was taking 1 - 2 minutes to process the files after download. I'm not sure why that part takes that long but I was able to move that off the main thread so it doesn't freeze the UI. I also updated the text on the audiobook page to say "Download complete. Processing..." instead of it looking like it is stuck at 100%.
Author
Owner

@advplyr commented on GitHub (Feb 23, 2023):

Fixed in v0.9.62-beta

@advplyr commented on GitHub (Feb 23, 2023): Fixed in [v0.9.62-beta](https://github.com/advplyr/audiobookshelf-app/releases/tag/v0.9.62-beta)
Author
Owner

@kebbe commented on GitHub (Feb 24, 2023):

Works fine, thank you.

@kebbe commented on GitHub (Feb 24, 2023): Works fine, thank you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#433