Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Android data base fix #1970

Merged
merged 2 commits into from
Dec 26, 2018
Merged

Android data base fix #1970

merged 2 commits into from
Dec 26, 2018

Conversation

lvfen
Copy link
Contributor

@lvfen lvfen commented Dec 26, 2018

fix a crash for storageModule:
crash stack
java stack
java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed.
at android.database.sqlite.SQLiteConnectionPool.throwIfClosedLocked(SQLiteConnectionPool.java:962)
at android.database.sqlite.SQLiteConnectionPool.waitForConnection(SQLiteConnectionPool.java:599)
at android.database.sqlite.SQLiteConnectionPool.acquireConnection(SQLiteConnectionPool.java:348)
at android.database.sqlite.SQLiteSession.acquireConnection(SQLiteSession.java:894)
at android.database.sqlite.SQLiteSession.executeForLong(SQLiteSession.java:650)
at android.database.sqlite.SQLiteStatement.simpleQueryForLong(SQLiteStatement.java:125)
at android.database.DatabaseUtils.longForQuery(DatabaseUtils.java:886)
at android.database.DatabaseUtils.longForQuery(DatabaseUtils.java:874)
at android.database.sqlite.SQLiteDatabase.getPageSize(SQLiteDatabase.java:941)
at android.database.sqlite.SQLiteDatabase.setMaximumSize(SQLiteDatabase.java:924)
at com.taobao.weex.appfram.storage.WXSQLiteOpenHelper.ensureDatabase(WXSQLiteOpenHelper.java:179)
at com.taobao.weex.appfram.storage.WXSQLiteOpenHelper.getDatabase(WXSQLiteOpenHelper.java:78)
at com.taobao.weex.appfram.storage.DefaultWXStorage.performGetItem(DefaultWXStorage.java:239)
at com.taobao.weex.appfram.storage.DefaultWXStorage.access$100(DefaultWXStorage.java:39)
at com.taobao.weex.appfram.storage.DefaultWXStorage$2.run(DefaultWXStorage.java:79)
at com.taobao.weex.common.WXThread$SafeRunnable.run(WXThread.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

This exception is caused by asynchronous read and write db, so add try catch to db operation and move close operation to same thread

@weex-bot
Copy link

weex-bot commented Dec 26, 2018

Fails
🚫 Failed to run assembleDebug task for android.
Messages
📖 android build verification finished.

Generated by 🚫 dangerJS

Copy link
Contributor

@YorkShen YorkShen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@YorkShen YorkShen merged commit e8a7c93 into apache:master Dec 26, 2018
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