Skip to content
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

PlaybackStatsListener causes crash #8772

Closed
iNdieboyjeff opened this issue Mar 29, 2021 · 12 comments
Closed

PlaybackStatsListener causes crash #8772

iNdieboyjeff opened this issue Mar 29, 2021 · 12 comments
Assignees

Comments

@iNdieboyjeff
Copy link

ExoPlayer 2.13.2

Upgrading from ExoPlayer 2.12.3 -> 2.13.2 I'm finding that everything works fine, but when I close my PlayerActivity my app is crashing. The error we get is:

java.lang.IllegalArgumentException
        at com.google.android.exoplayer2.util.Assertions.checkArgument(Assertions.java:41)
        at com.google.android.exoplayer2.analytics.PlaybackStatsListener$PlaybackStatsTracker.updatePlaybackState(PlaybackStatsListener.java:679)
        at com.google.android.exoplayer2.analytics.PlaybackStatsListener$PlaybackStatsTracker.onFinished(PlaybackStatsListener.java:477)
        at com.google.android.exoplayer2.analytics.PlaybackStatsListener.onSessionFinished(PlaybackStatsListener.java:183)
        at com.google.android.exoplayer2.analytics.DefaultPlaybackSessionManager.finishAllSessions(DefaultPlaybackSessionManager.java:247)
        at com.google.android.exoplayer2.analytics.PlaybackStatsListener.onEvents(PlaybackStatsListener.java:291)
        at com.google.android.exoplayer2.analytics.AnalyticsCollector.lambda$setPlayer$1$AnalyticsCollector(AnalyticsCollector.java:141)
        at com.google.android.exoplayer2.analytics.-$$Lambda$AnalyticsCollector$yS3z67Oa1f_t9PmuRvwn2pyVDcQ.invoke(Unknown Source:8)
        at com.google.android.exoplayer2.util.ListenerSet$ListenerHolder.release(ListenerSet.java:287)
        at com.google.android.exoplayer2.util.ListenerSet.release(ListenerSet.java:230)
        at com.google.android.exoplayer2.util.ListenerSet.handleMessage(ListenerSet.java:266)
        at com.google.android.exoplayer2.util.ListenerSet.lambda$eEvjP-IE0x3J2lRvKfFbbjRFRvc(Unknown Source:0)
        at com.google.android.exoplayer2.util.-$$Lambda$ListenerSet$eEvjP-IE0x3J2lRvKfFbbjRFRvc.handleMessage(Unknown Source:2)
        at android.os.Handler.dispatchMessage(Handler.java:108)
        at android.os.Looper.loop(Looper.java:216)
        at android.app.ActivityThread.main(ActivityThread.java:7625)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

I've noticed that in our code:

playerStatsListener = PlaybackStatsListener(false, null)
addAnalyticsListener(playerStatsListener!!)

if I simply comment out the addAnalyticsListener call then the crash does not happen.

Is this crash a new problem with PlaybackStatsListener, and is there a fix for it?

A secondary question would be, given that we're not using a callback with PSL, is there any drawback to simple not adding the listener (at least until such time as the crash is fixed)?

I'm not sure if this counts as a separate issue to #8675 or not as we are using DRM protected Widevine-DASH VOD content, not a live stream.

@tonihei
Copy link
Collaborator

tonihei commented Mar 29, 2021

Looks like the same issue as #8675, which may occur if you reset the same player with new media or use another player with the same listener attached, AND a seek happens just before the new playback starts. You said it's happening when you close your Activity? Can you check whether something in your code is attempting to seek just before you release the player?

@iNdieboyjeff
Copy link
Author

I can't see anything in the code that would be causing a seek and none of the available logging suggests any kind of seek is going on.

@tonihei
Copy link
Collaborator

tonihei commented Mar 29, 2021

If you have a way to reproduce, can you describe what we'd need to do to see the same problem here or upload a small example project showing the problem?

Alternatively, it's probably quicker to wait until we uploaded the fix for #8675 and test against the ExoPlayer version with this fix to see if it's indeed the same problem.

@iNdieboyjeff
Copy link
Author

It looks like if I remove the PSL from the player before calling release then I don't get the crash (at least this seems to be working from the limited testing I've done so far)

@tonihei
Copy link
Collaborator

tonihei commented Mar 29, 2021

Yes, this is avoiding the issue, but I'm trying to find out whether there is something we need to fix here besides the fix for #8675.

@iNdieboyjeff
Copy link
Author

Well from what I've looked at today, what I've seen is:

  • There was no issue in Exo 2.12, but only once we upgraded - so it's a new behaviour
  • I could not find any seek being called anywhere. This was happening in both player versions in our app (1 for mobile, 1 for TV). The player(s) are however very complicated so I'd probably only be able to be 90% confident this wasn't the issue. Apologies that I can't be 100% confident of this.
  • Workaround mentioned above does at least work (so we can complete the version update for our app at any rate)

@tonihei

This comment has been minimized.

@VivekBhalodiyaMM
Copy link

@VivekBhalodiyaMM This is unrelated and old bug that got fixed in 2.13.0

Thank you @tonihei I'll verify and check.

@iNdieboyjeff
Copy link
Author

As an update to this:

We attempted to do as much as we could to ensure the analytics listeners were removed before releasing the player. This resolved any crashing issues we were seeing locally. However out in the wild we were still seeing a huge volume of crashes related to this Assertion check, and nothing seemed to suggest a problem on our side. Eventual solution was to clone the repo, and compile with assertions disabled. Bingo - no more crashes. It was either this or revert to the previously stable version of ExoPlayer before the crashes started happening.

@tonihei
Copy link
Collaborator

tonihei commented May 19, 2021

Did you try to use the fix for #8675? It's now also been released as part of 2.14.0, so you should be able to upgrade to this version to get the fix as well.

@google-oss-bot
Copy link
Collaborator

Hey @iNdieboyjeff. We need more information to resolve this issue but there hasn't been an update in 14 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link
Collaborator

Since there haven't been any recent updates here, I am going to close this issue.

@iNdieboyjeff if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@google google locked and limited conversation to collaborators Aug 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants