Skip to content

Comments

Handle SQLiteDatabaseLockedException in CachedContentIndex#10959

Merged
christosts merged 1 commit intogoogle:dev-v2from
balachandarlinks:handle-sql-exception-in-cached-content-index
Feb 14, 2023
Merged

Handle SQLiteDatabaseLockedException in CachedContentIndex#10959
christosts merged 1 commit intogoogle:dev-v2from
balachandarlinks:handle-sql-exception-in-cached-content-index

Conversation

@balachandarlinks
Copy link

@balachandarlinks balachandarlinks commented Feb 2, 2023

SQLiteException is not caught and converted to IOException when trying to access databaseProvider.getReadableDatabase(). Hence exoplayer is not handling this cache related exception and crashing. Similar exception is properly handled here.

Stacktrace:

android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5)
	at android.database.sqlite.SQLiteConnection.nativeExecuteForLong()(SQLiteConnection.java:-2)
	at android.database.sqlite.SQLiteConnection.executeForLong()(SQLiteConnection.java:598)
	at android.database.sqlite.SQLiteSession.executeForLong()(SQLiteSession.java:652)
	at android.database.sqlite.SQLiteStatement.simpleQueryForLong()(SQLiteStatement.java:107)
	at android.database.DatabaseUtils.longForQuery()(DatabaseUtils.java:825)
	at android.database.DatabaseUtils.longForQuery()(DatabaseUtils.java:813)
	at android.database.sqlite.SQLiteDatabase.getVersion()(SQLiteDatabase.java:864)
	at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked()(SQLiteOpenHelper.java:241)
	at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase()(SQLiteOpenHelper.java:187)
	at com.google.android.exoplayer2.upstream.cache.CachedContentIndex$DatabaseStorage.exists()(CachedContentIndex.java:2)
	at com.google.android.exoplayer2.upstream.cache.CachedContentIndex.initialize()(CachedContentIndex.java:4)
	at com.google.android.exoplayer2.upstream.cache.SimpleCache.initialize()(SimpleCache.java:13)
	at com.google.android.exoplayer2.upstream.cache.SimpleCache.access$000()(SimpleCache.java:1)
	at com.google.android.exoplayer2.upstream.cache.SimpleCache$1.run()(SimpleCache.java:3)

This particular crash happens a lot in firetv specifically incomparison to Android tv and mobile.

@microkatz microkatz self-assigned this Feb 2, 2023
@microkatz microkatz self-requested a review February 7, 2023 11:08
@christosts christosts merged commit 20a5e46 into google:dev-v2 Feb 14, 2023
tonihei pushed a commit that referenced this pull request Mar 2, 2023
…in-cached-content-index

PiperOrigin-RevId: 508323432
tonihei pushed a commit that referenced this pull request Mar 2, 2023
…in-cached-content-index

PiperOrigin-RevId: 508323432
(cherry picked from commit 20a5e46)
@google google locked and limited conversation to collaborators Apr 16, 2023
@balachandarlinks balachandarlinks deleted the handle-sql-exception-in-cached-content-index branch May 9, 2023 14:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants