You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2018/12/26 07:20:06 UTC

[GitHub] lvfen opened a new pull request #1967: [Android]fix WXSQLiteOpenHelper crash

lvfen opened a new pull request #1967: [Android]fix WXSQLiteOpenHelper crash
URL: https://github.com/apache/incubator-weex/pull/1967
 
 
   ### 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, now add try catch to zhe code block. 
   To solve this problem really needs to put the close db into the same thread as the read db.
   
   
   First of all, thank you for your contribution! 
   
   Please makes sure that these checkboxes are checked before submitting your PR, thank you!
   
   <!-- 
   How to use github markdown?
   ### checkable example
   - [x] checked
   - [ ] not checked
   More github Markdown info to see https://guides.github.com/features/mastering-markdown/
   -->
   
   CheckList:
   
   **if** *isBugFix* **:**
   
     * [ ] Make sure that you add at least one unit test for the bug which you had fixed.
   
   **elif** *isNewFeature* **:**
   
     * [ ] Update API docs for the component.
     * [ ] Update/Add demo to demonstrate new feature.
     * [ ] Update test scripts for the feature.
     * [ ] Add unit tests for the feature.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services