cloudant / sync-android

A JSON-based document datastore for Android applications
Apache License 2.0
267 stars 91 forks source link

forceInsert_currentRevisionNotInTheHistory_exception fails on device #313

Closed ricellis closed 8 years ago

ricellis commented 8 years ago

The com.cloudant.sync.datastore.DatastoreImplForceInsertTest.forceInsert_currentRevisionNotInTheHistory_exception test is failing when running on a Nexus 7 (although it doesn't fail on the emulator). Log reveals a number of:

W/SQLiteConnectionPool( 6957): A SQLiteConnection object for database '/data/data/cloudant.com.androidtest/cache/com.cloudant.sync.datastore.DatastoreImplForceInsertTest_fcb220c5-ee54-464d-a83f-e2ec8fdb995f/db.sync' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.

and

E/SQLiteLog( 6957): (14) cannot open file at line 28379 of [00bb9c9ce4] E/SQLiteLog( 6957): (14) os_unix.c:28379: (2) open(/data/data/cloudant.com.androidtest/cache/com.cloudant.sync.datastore.DatastoreImplForceInsertTest_bbcd4851-ec01-4767-877e-45504757f945) - E/SQLiteLog( 6957): (1802) os_unix.c:30026: (2) stat(/data/data/cloudant.com.androidtest/cache/com.cloudant.sync.datastore.DatastoreImplForceInsertTest_bbcd4851-ec01-4767-877e-45504757f945/db.sync) - E/SQLiteLog( 6957): (1802) statement aborts at 9: [CREATE TABLE info ( key TEXT PRIMARY KEY, value TEXT);] E/SQLiteLog( 6957): (1) statement aborts at 2: [ROLLBACK;] cannot rollback - no transaction is active W/dalvikvm( 6957): threadid=14: thread exiting with uncaught exception (group=0x4160bba8) E/SQLiteLog( 6957): (1802) os_unix.c:30026: (2) stat(/data/data/cloudant.com.androidtest/cache/com.cloudant.sync.datastore.DatastoreImplForceInsertTest_bbcd4851-ec01-4767-877e-45504757f945/db.sync) - E/SQLiteLog( 6957): (1802) statement aborts at 4: [ALTER TABLE attachments ADD COLUMN encoding INTEGER DEFAULT 0;] E/SQLiteLog( 6957): (1) statement aborts at 2: [ROLLBACK;] cannot rollback - no transaction is active W/dalvikvm( 6957): threadid=15: thread exiting with uncaught exception (group=0x4160bba8) I/Process ( 6957): Sending signal. PID: 6957 SIG: 9 D/AndroidRuntime( 6946): Shutting down VM E/AndroidRuntime( 6957): FATAL EXCEPTION: pool-26-thread-1 E/AndroidRuntime( 6957): Process: cloudant.com.androidtest, PID: 6957 E/AndroidRuntime( 6957): android.database.sqlite.SQLiteException: cannot rollback - no transaction is active (code 1) E/AndroidRuntime( 6957): at android.database.sqlite.SQLiteConnection.nativeExecute(Native Method) E/AndroidRuntime( 6957): at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:555) E/AndroidRuntime( 6957): at android.database.sqlite.SQLiteSession.endTransactionUnchecked(SQLiteSession.java:439) E/AndroidRuntime( 6957): at android.database.sqlite.SQLiteSession.endTransaction(SQLiteSession.java:401) E/AndroidRuntime( 6957): at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java:522) E/AndroidRuntime( 6957): at com.cloudant.sync.sqlite.android.AndroidSQLite.endTransaction(AndroidSQLite.java:76) E/AndroidRuntime( 6957): at com.cloudant.sync.sqlite.SQLDatabaseFactory.updateSchema(SQLDatabaseFactory.java:206) E/AndroidRuntime( 6957): at com.cloudant.sync.sqlite.SQLDatabaseQueue$2.run(SQLDatabaseQueue.java:82) E/AndroidRuntime( 6957): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) E/AndroidRuntime( 6957): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) E/AndroidRuntime( 6957): at java.lang.Thread.run(Thread.java:841)

ricellis commented 8 years ago

Fixed by closing Datastores left open in some tests by PR #314.