[Bug]: Race condition when trying to play locally downloaded books during app startup #1274

Open
opened 2026-04-24 23:56:20 +02:00 by adam · 6 comments
Owner

Originally created by @wtanksleyjr on GitHub (Sep 5, 2025).

I have verified that the bug is not already awaiting release

Yes

What was the Problem?

This is easiest to see with a very large library; the bigger the library the longer the time where this will be a problem.

When starting the app, it's possible to start playing any local (downloaded) book, so long as you open the book before the app connects with the server and starts to sync.

If you're a touch too slow in opening the book you want (and therefore the server is contacted), the book screen will be opened, but will be grey with green progress dots, so nothing can be done except backing out to the main screen (where you can try and fail to open all the rest of your locally downloaded books).

This will continue until all of the data to display the home page is loaded, but on my server this is between 30 seconds and 10 minutes, usually about 2 minutes - long enough that the phone will lock if not carefully watched, apparently losing progress and forcing it all to happen again.

My family members have given up and stopped using the app due to this; they'll request an RSS feed, which is a decent workaround.

Steps to Reproduce the Issue

  1. Set up a large server.
  2. Access from app, download a few books.
  3. Kill the app.
  4. Restart and try to play those books quickly. You should notice the server's sync state change.

What was Expected?

Ideally downloaded books could always be opened even if the server's in the middle of a sync; perhaps just display the cached info like we'd see .if the server were entirely offline.

Phone Model

iOS and Android

Phone OS

never seen it not happen

Audiobookshelf App Version

Android App - 0.10.1

Installation Source

Google Play Store

Additional Notes

No response

Originally created by @wtanksleyjr on GitHub (Sep 5, 2025). ### I have verified that the [bug is not already awaiting release](https://github.com/advplyr/audiobookshelf-app/issues?q=is%3Aissue%20label%3A%22awaiting%20release%22) Yes ### What was the Problem? This is easiest to see with a very large library; the bigger the library the longer the time where this will be a problem. When starting the app, it's possible to start playing any local (downloaded) book, so long as you open the book before the app connects with the server and starts to sync. If you're a touch too slow in opening the book you want (and therefore the server is contacted), the book screen will be opened, but will be grey with green progress dots, so nothing can be done except backing out to the main screen (where you can try and fail to open all the rest of your locally downloaded books). This will continue until all of the data to display the home page is loaded, but on my server this is between 30 seconds and 10 minutes, usually about 2 minutes - long enough that the phone will lock if not carefully watched, apparently losing progress and forcing it all to happen again. My family members have given up and stopped using the app due to this; they'll request an RSS feed, which is a decent workaround. ### Steps to Reproduce the Issue 1. Set up a large server. 2. Access from app, download a few books. 3. Kill the app. 4. Restart and try to play those books quickly. You should notice the server's sync state change. ### What was Expected? Ideally downloaded books could always be opened even if the server's in the middle of a sync; perhaps just display the cached info like we'd see .if the server were entirely offline. ### Phone Model iOS and Android ### Phone OS never seen it not happen ### Audiobookshelf App Version Android App - 0.10.1 ### Installation Source Google Play Store ### Additional Notes _No response_
adam added the bug label 2026-04-24 23:56:20 +02:00
Author
Owner

@nichwall commented on GitHub (Sep 5, 2025):

I've never seen this happen, can you provide a screen recording or similar for reference?

@nichwall commented on GitHub (Sep 5, 2025): I've never seen this happen, can you provide a screen recording or similar for reference?
Author
Owner

@wtanksleyjr commented on GitHub (Sep 5, 2025):

Sure thing. Today was REALLY bad so I didn't get a success example, my server's still thrashing away not producing a response while my app's just sitting there not showing any books. But here it is not opening books:

Hm. Github won't accept it. Now what?

@wtanksleyjr commented on GitHub (Sep 5, 2025): Sure thing. Today was REALLY bad so I didn't get a success example, my server's still thrashing away not producing a response while my app's just sitting there not showing any books. But here it is not opening books: Hm. Github won't accept it. Now what?
Author
Owner

@wtanksleyjr commented on GitHub (Sep 5, 2025):

Server's cache is warmed up now, so I can't make it happen again for a bit. This only shows when the server responds so that there's a connection, and then thrashes - which is every morning, and then randomly through the day.

I asked about this on the Discord and got replies saying sure they knew it happens.

@wtanksleyjr commented on GitHub (Sep 5, 2025): Server's cache is warmed up now, so I can't make it happen again for a bit. This only shows when the server responds so that there's a connection, and then thrashes - which is every morning, and then randomly through the day. I asked about this on the Discord and got replies saying sure they knew it happens.
Author
Owner

@wtanksleyjr commented on GitHub (Sep 5, 2025):

OK, I cut it WAY down, since it's really a fail - I wanted to show all of the steps, but it didn't finish loading for some 5 minutes, not what you want to see. This ONLY shows the main screen, and then clicking on a book and seeing it not load.

https://github.com/user-attachments/assets/2b5ac836-33d6-47b5-9d60-183cd470976c

@wtanksleyjr commented on GitHub (Sep 5, 2025): OK, I cut it WAY down, since it's really a fail - I wanted to show all of the steps, but it didn't finish loading for some 5 minutes, not what you want to see. This ONLY shows the main screen, and then clicking on a book and seeing it not load. https://github.com/user-attachments/assets/2b5ac836-33d6-47b5-9d60-183cd470976c
Author
Owner

@wtanksleyjr commented on GitHub (Sep 5, 2025):

This is actually a VERY unusual situation, usually when it's saying "Attempting server connection" you can open books, and it's only when it switches to something I can't remember ofc about syncing server data that the downloaded books all lock. But this goes to show it's not REALLY about the display, there's something else.

@wtanksleyjr commented on GitHub (Sep 5, 2025): This is actually a VERY unusual situation, usually when it's saying "Attempting server connection" you can open books, and it's only when it switches to something I can't remember ofc about syncing server data that the downloaded books all lock. But this goes to show it's not REALLY about the display, there's something else.
Author
Owner

@nichwall commented on GitHub (Sep 5, 2025):

Thanks for the video.

Yeah, the long time connecting to the server is a known issue with large libraries on the server. In the meantime you can also disconnect from the server using the menu in the upper right and just listen in offline mode.

@nichwall commented on GitHub (Sep 5, 2025): Thanks for the video. Yeah, the long time connecting to the server is a known issue with large libraries on the server. In the meantime you can also disconnect from the server using the menu in the upper right and just listen in offline mode.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#1274