-
Notifications
You must be signed in to change notification settings - Fork 540
ANR when tap seek to button and play/pause button simultaneously #1197
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
Comments
Thanks for reporting! I can repro this when I change the session demo app and build the player with an application looper different to the main thread and then call
We are looking into a fix for this. I'm not sure how easy it is for your app to do fix with the current version. From the snippet above the only advise I can see is to no call Using the main thread as the application thread of the player helps as well, but you have probably chosen to do so for a reason. I understand this is probably not easily possible depending on the design of an app. It's also not a solution from the library side that should support sending commands that way. I don't think I have a better advise for this now I'm afraid. We will update this issue when we have more information around a fix for this issue. |
Thanks for the pull request. I think adding Future to these methods is only a workaround that doesn't fix the root cause I'm afraid. I see whether I can find time to look into this asap. |
Hi @marcbaechinger, based on my investigation, the following sequence of events happens.
However, main thread is still stuck in seekToNextMediaItem and player/application thread is still holding command queue lock waiting for onPlayRequested, then deadlock happens. My solution uses the existing MediaSessionStub functionality to submit a long-running command using a Future which will set command queue to "flushing" (will not run new commands until this one is done, but allows to queue more commands), but will free the controller command queue lock so that seek command can be added. Then main thread returns to looping because it was able to queue command, and we get our result from onPlayRequested which then completes another future that unsets the flushing state so that next command (seek) will be processed. I'm not sure if there's any other sensible way to solve it, but I'll wait for your review. Thanks for looking into it! |
@marcbaechinger Ping as it's been a month since I opened the PR, to keep it on the radar. My apologies if I am too impatient, it's just hard to me to know wheter it fell off the radar or if there's no time for it. |
Version
Media3 1.3.0
More version details
No response
Devices that reproduce the issue
Pixel 4 XL (Android 13)
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
Expected result
It works normally.
Actual result
Media
anr_2024-03-19-00-42-14-290.zip
Bug Report
adb bugreport
to [email protected] after filing this issue.The text was updated successfully, but these errors were encountered: