-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auxio crashes on any playback with android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed
#825
Comments
Okay. I'll try to investigate this. The weird part is that I've not changed really anything, so it's OEMs doing weird stuff. |
Then the change causing the crashes was by Google. ArrowOS is currently stale and has not seen an update since several months. |
What I find surprising, that this does not seem to affect many users. For me Auxio is bearly unusable in 3.5.2. I see frequent crashes. What does seem to reliably trigger a crash is when using the shuffle button. After a crash I am greeted with the Retry | More dialog. |
@foss- Is the app in background state when this issue occurs? I probably suspect that is the case, because the above error you highlighted is caused due to starting a foreground service from background(which is not permissible on Android 12 and above) |
I don't think the app is in the background when it crashes. I closed the app and open it, press shuffle and a track starts playing. I press shuffle 2 or 3 times more and Auxio crashes with
The app was not closed or in background during the test. |
My theory @foss- is that this is a weird race condition, that I either start music loading/playback after Android OK's the service to go foreground and all is well, or before and it fails, but I have zero clue how it's happening since the lifecycle didn't meaningfully change. Maybe there's something dumb and fiddly that Android does with MediaBrowserServices in particular (started using that in 3.5.0), that would make sense since it's insane behavior and undocumented. |
Can you try this out at all @foss-? No guarantees this will actually work in prod, but I delayed the start of indexing until after the bind/start-command stage, so hopefully your ROM will tolerate me going foreground so quickly. Also pinging @nitinsooni since they had this issue. |
Thanks for looking into this. Tested this. Noticed on first launch that while The first scan failed and I tapped Retry. Ran into a failed scan again. More output shows:
|
Sorry @foss-, forgot to merge some critical 3.5.2 changes into the branch. Try this? The lack of (X/NNN) indicator in the loading screen is intended, it turns out to have taken up a lot of CPU and I wanted to avoid that. |
Thanks for the new test version and elaborating on why the counter was removed. The test build crashed when I tried playing a song before I could hear any audio. After re-opening Auxio, the library is reloaded. I was then able to play a few tracks. Auxio skipped to the next track as expected. Leaving the app opening other apps works and music keeps playing. What reliably seems to still trigger a crash is using shuffle. This is true for using shuffle in In another test round Auxio crashed a few seconds after playing a track - no shuffle involved. |
Can you please take a new bug report when the crash happens @foss-? |
That bug report method included a few too many sensitive details. But I created a logcat and this is the output: 16:52:00 tap shuffle logcat (1 month): https://bin.disroot.org/?60dbd5822626b2eb#8eHmRim39xXJ26yXwJ8SuwwmGjeuKMnkzDN1ctMPQ9a error is: Hope this is helpful. If you need more/other info let me know. |
How many songs do you have in your library? @foss- I think the issue is Media3. I was aware of it being inefficient before, but I thought it just if I used it in the UI. This is the second OOM I've encountered so far and I think at this point it just flat out CANNOT work with large playlists. I need to rip out all of the internals and go back to the old versions. |
Can you see what happens if you play something smaller like an album @foss-? |
~35k songs, guess that's qualifies as somewhat large library. There seems to be very active development around Media3. What I am wondering, since this is still Android 13, if this issue would happen also on Android 14. The rom I am using is abandonware, so I'll need to switch to something else anyways. But I need to find the time for a proper migration, which won't be happening near term. So if the issue is limited to old Android 13, not sure if bothering is worth it. I may be able to test Android 14 on another device. Oh and also: the music library resides on an SD-card so maybe that is a major factor of the trouble I am seeing, although it did work reliable I'd say in the past with Auxio. Re: playing something smaller like an album: Playing from album section seems to work reliable, very interesting. Wasn't aware and that's a good workaround. |
Okay, yeah I'd see how Media3 might choke on a 35k song playlist. There are some longstanding issues on how Media3 dispatches queue updates, it can be EXTREMELY slow (largely from serialization) and the work is duplicated quite a lot. So it could probably be easy to OOM too. Im going to send a pre-Media3 and post-Media3 build and see if the issue can be definitively traced to that. If it isn't, it's my fault (yay!), otherwise, I have to rip out basically all of the work done in 3.5.0 and revert to using the old way of doing android auto stuff. Sigh... |
Here's a really old pre-media3 build @foss-, it might crash in some weird way, no idea: Auxio_DelayFG3.zip |
Gave Auxio_DelayFG3.zip a spin. Still crashing when playing tracks from Song category. Playing from Albums category works fine. Am I understanding correctly that the crashes would be unexpected as this is a pre media3 build? As for the Media3 issues - are there open issues you can link (just curious)? |
Yeah, so it's a deeper issue, strangely. Will send another even earlier build @foss- |
Not sure if this applies to this project, but wanted to mention if you are using any sort of Job delay when calling startForeground or startService, Android will throw the error reported. Even in situations that Google considers "exempt" fail if done with a delay. |
Sorry, what you mean by a Job delay @dreamsyntax? |
Considering this fixed and moving the memory problem into #842 |
Officially shipped in 3.5.3. @foss- |
Describe the Bug/Crash
This is a new problem, at least for me, which did not happen in 3.5.0 and earlier.
Describe the intended behavior
no crash
What android version do you use?
Android 13
What device model do you use?
lisa, ArrowOS 13.1
Auxio 3.5.2
Provide a sample file
N/A
Bug report
Duplicates
The text was updated successfully, but these errors were encountered: