User-space exception detected! java.lang.IllegalStateException: no transaction pending


#1

User-space exception detected!
java.lang.IllegalStateException: no transaction pending
at net.sqlcipher.database.SQLiteDatabase.endTransaction(SQLiteDatabase.java:706)
at com.activeandroid.ActiveAndroid.endTransaction(ActiveAndroid.java:46)


#2

Hi @srinivas3120

Is this something that you can reproduce? We would be happy to look into this further if you can create a test case that reproduces the error. Thanks!


#3

I don’t know how can i reproduce this. but it happens very frequently.
what causes User-space exception detected!

All database operations are singleton.
on every upgrade, i was changing the encrypted password.

  SQLiteDatabase db = openDatabase();
  final String PRAGMA_KEY = String.format("PRAGMA key = '%s';", oldPass);
  final String PRAGMA_REKEY = String.format("PRAGMA rekey = '%s';", newPass);
  db.rawExecSQL("BEGIN IMMEDIATE TRANSACTION;");
  db.rawExecSQL(PRAGMA_KEY);
  db.rawExecSQL(PRAGMA_REKEY);

#4

@srinivas3120 - have you tried removing the begin transaction from before the pragma key? Rekey already uses a transaction internally.


#5

what about key ? does it use transaction internally ?


#6

@srinivas3120 - no key doesn’t use a transaction because it does not actually touch the database.