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

IllegalStateException at DefaultDownloadIndex.getDownloadForCurrentRow #6785

Closed
iNdieboyjeff opened this issue Dec 19, 2019 · 4 comments
Closed
Assignees
Labels

Comments

@iNdieboyjeff
Copy link

iNdieboyjeff commented Dec 19, 2019

Issue description

The following crash is being seen in Crashlytics

Fatal Exception: java.lang.IllegalStateException
       at com.google.android.exoplayer2.util.Assertions.checkState(Assertions.java:81)
       at com.google.android.exoplayer2.offline.Download.<init>(Download.java:133)
       at com.google.android.exoplayer2.offline.DefaultDownloadIndex.getDownloadForCurrentRow(DefaultDownloadIndex.java:359)
       at com.google.android.exoplayer2.offline.DefaultDownloadIndex.access$100(DefaultDownloadIndex.java:35)
       at com.google.android.exoplayer2.offline.DefaultDownloadIndex$DownloadCursorImpl.getDownload(DefaultDownloadIndex.java:409)
       at com.google.android.exoplayer2.offline.DownloadManager$InternalHandler.initialize(DownloadManager.java:697)
       at com.google.android.exoplayer2.offline.DownloadManager$InternalHandler.handleMessage(DownloadManager.java:630)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:216)
       at android.os.HandlerThread.run(HandlerThread.java:65)

It appears that the download progress is null which is failing the assertion. From what I can see this progress is returned from the database.

Over the last 90 days: This issue has 1070 crashes affecting 110 users.

Reproduction steps

We have not been able to reproduce this issue ourselves, but it is currently our biggest crash in Crashlytics and has recently generated a velocity alert.

Link to test content

If required please let us know and we can try to provide access to a test user account

A full bug report captured from the device

As above this is an issue from Crashlytics so unable to capture a bug report ourselves

Version of ExoPlayer being used

v2.10.4

Device(s) and version(s) of Android being used

80% Samsung (Galaxy S8, S9, S8+)
5% Huawei (p20 lite, Y7 Prime 2019, P smart 2019)
4% OnePlus (A6000, 7T Pro, 5T)
4% OPPO (CPH1725)
56% Other

65% Android 9
23& Android 8
6% Android 7
3% Android 5
3% Other

25% In background
0% Rooted
93% Proximity On

@ojw28 ojw28 changed the title Crash com.google.android.exoplayer2.util.Assertions.checkState (Line 81) IllegalStateException at DefaultDownloadIndex.getDownloadForCurrentRow Dec 19, 2019
@ojw28
Copy link
Contributor

ojw28 commented Dec 20, 2019

Thanks for the report. Does your app happen to call DownloadService.sendRemoveAllDownloads, DownloadService.buildRemoveAllDownloadsIntent or DownloadManager.removeAllDownloads? I think I see a possible bug along those code paths that might explain this.

@ojw28 ojw28 self-assigned this Dec 20, 2019
@iNdieboyjeff
Copy link
Author

iNdieboyjeff commented Dec 20, 2019 via email

@ojw28
Copy link
Contributor

ojw28 commented Dec 20, 2019

Thanks. I think the problem occurs when removeAllDownloads is called with one or more downloads in the failed state. We will try and get a fix into 2.11.1.

ojw28 added a commit that referenced this issue Dec 20, 2019
The Download constructor considers it invalid to have a failure
reason if the download isn't in the failed state. Unfortunately,
calling DefaultDownloadIndex.removeAllDownloads when there's a
failed download will change the state without clearing the reason.
If the downloads are then read back from the DefaultDownloadIndex
we end up violating the Download constructor assertion.

This change clears the failed reason for any existing rows in the
invalid state, and also fixes the root cause that allows invalid
rows to enter the table in the first place.

Issue: #6785
PiperOrigin-RevId: 286576242
@ojw28
Copy link
Contributor

ojw28 commented Dec 20, 2019

This is most likely fixed by the change above. It will be included in 2.11.1, which we'll push today. Please let us know here if your users still see this problem after you update.

@ojw28 ojw28 closed this as completed Dec 20, 2019
ojw28 added a commit that referenced this issue Dec 20, 2019
The Download constructor considers it invalid to have a failure
reason if the download isn't in the failed state. Unfortunately,
calling DefaultDownloadIndex.removeAllDownloads when there's a
failed download will change the state without clearing the reason.
If the downloads are then read back from the DefaultDownloadIndex
we end up violating the Download constructor assertion.

This change clears the failed reason for any existing rows in the
invalid state, and also fixes the root cause that allows invalid
rows to enter the table in the first place.

Issue: #6785
PiperOrigin-RevId: 286576242
@google google locked and limited conversation to collaborators Feb 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants