audiobookshelf-app icon indicating copy to clipboard operation
audiobookshelf-app copied to clipboard

App crashing with downloaded books in shared storage folder (only for books with cover images)

Open Raptor05 opened this issue 1 year ago • 22 comments

Steps to reproduce

  1. Connect phone to Android Auto
  2. Choose a (downloaded) Audiobook
  3. App starts playing
  4. After few seconds, it's stuttering, stopping and crashing
  5. Try again when app is back
  6. After few seconds, it's stuttering, stopping and crashing
  7. Endless loop

Expected behaviour

  • The app is playing the track without crashing
  • Other apps like Spotify or Smart AuidioBook Player are still working fine

Actual behaviour

  • The app is playing the track, but crashing all the time

Environment data

Audiobookshelf Version: 0.9.73-beta

  • [x] Android App?
  • [ ] iOS App?

Server hosted on docker on Synology NAS

Android Issue

Android version: 13

Device model: Samsung Galaxy S20 FE (SM-G780G/DS)

Stock or customized system: Stock (Samsung One UI 5.1)

Android Auto Version: 11.4.640814-release

Raptor05 avatar Mar 20 '24 11:03 Raptor05

Seconded. Same issue, crashes app every time. Additionally, it often crashes my entire android auto app, and forces a reconnect, sometimes even crashing the launcher on my phone, forcing my phone to reload all app icons and widgets.

Device: Pixel 7 Android: 14 Stock: Yes Audiobookshelf versions with errors: 0.9.71-beta - current (at least, i wasn't paying attention before .71)

Could be a duplicate of this issue, for which a patch was released but did not solve the problem for me: https://github.com/advplyr/audiobookshelf-app/issues/1040

joshaconnor avatar Mar 20 '24 17:03 joshaconnor

Seconded. Same issue, crashes app every time. Additionally, it often crashes my entire android auto app, and forces a reconnect, sometimes even crashing the launcher on my phone, forcing my phone to reload all app icons and widgets.

Yes, sometimes the whole android auto app is crashing, too. Most of the time its reloading on its own, but sometimes I have to plug out and in the cable to force a reload. Thats a little bit annoying while driving.

Raptor05 avatar Mar 20 '24 18:03 Raptor05

I think this has to do with the app trying to connect to the server in the background but your server is not accessible.

Can you test this by opening the app before connecting to AA in your car and pressing "Disconnect" in the side drawer. If you are not connected to your server you will need to first connect to a server in the app then press disconnect.

That puts the app in "offline mode" and then android auto should not attempt to connect to a server and you won't see a crash if my theory is correct.

advplyr avatar Mar 21 '24 14:03 advplyr

Tested a few things along those lines.

Disconnect from server before starting car: works. Disconnect then close app before starting car: works. Leave connected but pre-start app on phone before starting car: works.

I did then try using the app without disconnecting and with the app closed before starting and it works. So the problem may be gone now? I did notice a new version of Android Auto got released, so maybe that had something to do with it. I did also notice that my app does show nothing for a moment (less than 2 seconds) when starting up, before the connecting symbol shows up followed by the server connecting and all the books showing up, so it could be a delay thing with attempting to connect.

joshaconnor avatar Mar 23 '24 23:03 joshaconnor

I tried it yesterday, too. Without disconnection, it crashed again. Then I disconnected it from server before starting android auto. This time it works. I didn't tried it again afterwards with connected app, I will do it the coming days.

Raptor05 avatar Mar 24 '24 15:03 Raptor05

Scratch my previous comment.

So, when I tried a couple weeks ago, a particular book was the one I was trying to listen at the time, which I had saved to external local storage, and have since moved on to other books. The new books I tried yesterday were ones that I wasn't reading before and may or may not have had problems, idk. Additionally, when downloading these new books to test your theory, I used internal local storage for both new books. After redownloading the old book to external storage and trying the disconnect method, it still did not work correctly. In fact, I had the app open on my phone and it was connected to the server when I attempted to start the book on my car screen, which crashed both. So it may have something to do with external storage. I'll continue testing permutations of possible problems to find what triggers the issue.

joshaconnor avatar Mar 24 '24 17:03 joshaconnor

Thanks for testing. One reason why I think this may have to do with the server connection is now the most prominent issue that crash analytics shows is:

image

This is most likely android auto related and if the app is in offline mode like I described above then it would skip over that function the crash log is saying is timing out.

Offline mode is not very built out at the moment so it specifically needs the "disconnect" button to get pressed before launching android auto. Preferably "disconnect" is pressed then the app is closed then it is launched only through android auto to make sure it is starting in offline mode. That should tell us for sure if this issue is the same one showing up in the crash analytics.

Some of the descriptions shared above to seem similar to permission issues I've seen in the past. The "stuttering" explained in the OP is what used to happen when there was a permission issue showing downloaded images in notifications. The 3rd most common crash showing up in the analytics looks similar and has to do with downloaded images but I don't know if it is android auto related. The only way I can think to test that one is to find a book that failed, then delete it from the mobile app, remove the cover image on the server, redownload the book on the mobile app without the cover, and try again.

advplyr avatar Mar 24 '24 18:03 advplyr

Alright, sorry for the long wait. I deleted the server file for the image, deleted everything from the app, then redownloaded the known problem book and it worked. I listened for 3 minutes, and it usually fails within 45 seconds, so I think that is the problem. I can do further testing if needed.

joshaconnor avatar Apr 02 '24 20:04 joshaconnor

@joshaconnor Thanks that helps. When you download the book are you storing that in internal storage (the default) or are you storing that in a folder on the device?

advplyr avatar Apr 02 '24 22:04 advplyr

A device folder, so external to the apps storage. I had problems with that so I kept doing it for consistency, but I can retest via internal if you need.

joshaconnor avatar Apr 03 '24 18:04 joshaconnor

Yeah that would be great if you can test with internal. Most of the permission issues have to do with device folder permissions that is why internal storage was added.

advplyr avatar Apr 03 '24 23:04 advplyr

Tested on internal storage as well, and without the image it works. An odd note, however, is that despite deleting the image from both server and local storage before redownloading, the android auto screen that shows the list of books still has the image as a thumbnail. It doesn't show in the book screen, just the list screen.

joshaconnor avatar Apr 11 '24 17:04 joshaconnor

@joshaconnor Are you also using a Samsung Galaxy? The same issue was reported in #1173 and I'm trying to find a pattern.

advplyr avatar Apr 19 '24 20:04 advplyr

Pixel 7, Stock Android (14 I think.)


Josh Connor (they/them) joshaconnor.com

On Fri, Apr 19, 2024, 16:08 advplyr @.***> wrote:

@joshaconnor https://github.com/joshaconnor Are you also using a Samsung Galaxy? The same issue was reported in #1173 https://github.com/advplyr/audiobookshelf-app/issues/1173 and I'm trying to find a pattern.

— Reply to this email directly, view it on GitHub https://github.com/advplyr/audiobookshelf-app/issues/1143#issuecomment-2067216428, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3LQGEIZZZ5TMRASFUFBDDY6F2TFAVCNFSM6AAAAABE7IMHW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRXGIYTMNBSHA . You are receiving this because you were mentioned.Message ID: @.***>

joshaconnor avatar Apr 19 '24 20:04 joshaconnor

Hmm I wonder if permission was lost on the folder you selected in the app to download audiobooks to. I have seen people mention that they had to remove the folder, re-add it and download the audiobooks again.

advplyr avatar Apr 19 '24 20:04 advplyr

No, other books work fine from both internal and external storage. It seems to just be the image issue, and it's only some books with some images.


Josh Connor (they/them) joshaconnor.com

On Fri, Apr 19, 2024, 16:35 advplyr @.***> wrote:

Hmm I wonder if permission was lost on the folder you selected in the app to download audiobooks to. I have seen people mention that they had to remove the folder, re-add it and download the audiobooks again.

— Reply to this email directly, view it on GitHub https://github.com/advplyr/audiobookshelf-app/issues/1143#issuecomment-2067250169, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3LQGGHZNWX47AV2BRK4X3Y6F5XLAVCNFSM6AAAAABE7IMHW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRXGI2TAMJWHE . You are receiving this because you were mentioned.Message ID: @.***>

joshaconnor avatar Apr 20 '24 07:04 joshaconnor

Am I right, that a temporary solution would be to not use the external storage but the default storage of audiobookshelf?

Raptor05 avatar Apr 20 '24 07:04 Raptor05

Yeah, that is a solution that does work.

joshaconnor avatar Apr 20 '24 07:04 joshaconnor

This is not specific to android auto so I updated the title. I'm not able to reproduce this on Pixel 6 on Android 13. This has been an issue with some devices for a while but I haven't been able to track down any pattern to it.

advplyr avatar Apr 28 '24 21:04 advplyr

Update: I've removed the external storage folder and re-downloaded all audiobooks into an internal storage folder. But unfortunately, it's still crashing. Is it enough to use an internal folder or do I have to use this "intenal app storage" thing?

Raptor05 avatar May 23 '24 06:05 Raptor05

I don't know for sure since I can't reproduce it but the internal app storage was added specifically for permission issues so that should work

advplyr avatar May 23 '24 09:05 advplyr

I'm using the internal app storage for all my downloads and I'm still getting this issue, but only when there's a cover there. If I use adb shell to go and delete the cover (because the app will let me delete any of the audio files, but never the cover for some reason), then it works perfectly.

Obviously I'd love for this to be fixed completely, but the option to delete the downloaded cover from within the app or the option to not download the cover at all would be a good quick fix.

I'm using a Google Pixel 4a with LineageOS 21 (Android 14) for the record.

DoctorDalek1963 avatar Jul 09 '24 12:07 DoctorDalek1963