Android Question Random error with Sqlite SQLCipher

rscheel

Well-Known Member
Licensed User
Longtime User
I have the following error with the library SQLCipher 1.40 this I use to initialize the encrypted BD SQLite, for the cursor I used the SQL library v1.50, I understand that the error is the cursor, I do not know how to solve it. Any help would greatly appreciate them.

B4X:
java.util.concurrent.TimeoutException: net.sqlcipher.database.SQLiteCursor.finalize() timed out after 10 seconds
    at java.lang.Object.wait(Native Method)
    at java.lang.Thread.parkFor$(Thread.java:1220)
    at sun.misc.Unsafe.park(Unsafe.java:299)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:810)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:844)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1173)
    at java.util.concurrent.locks.ReentrantLock$FairSync.lock(ReentrantLock.java:196)
    at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:257)
    at net.sqlcipher.database.SQLiteDatabase.lock(SQLiteDatabase.java:490)
    at net.sqlcipher.database.SQLiteProgram.close(SQLiteProgram.java:294)
    at net.sqlcipher.database.SQLiteQuery.close(SQLiteQuery.java:136)
    at net.sqlcipher.database.SQLiteCursor.close(SQLiteCursor.java:510)
    at net.sqlcipher.database.SQLiteCursor.finalize(SQLiteCursor.java:595)
    at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:202)
    at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:185)
    at java.lang.Thread.run(Thread.java:818)
 

rscheel

Well-Known Member
Licensed User
Longtime User
Is it possible that you started a transaction and never ended it?

I think in this case I start one and did not finish it, something happens if I remove the BeginTransaction?

B4X:
Sub ObtenerMantencionesAbiertas
    Id_Mantencion = 0
    ModConn.s.BeginTransaction
    ModConn.c = ModConn.s.ExecQuery("SELECT m.*, (SELECT t.mecanico FROM mecanico t WHERE t.id_mecanico = m.id_mecanico) mecanico FROM eventos m WHERE m.sync = 0 AND m.codigo_qr = '"&ValorQr&"' AND id_tipoevento = -1 ;")
    If ModConn.c.RowCount <> 0 Then
        For i = 0 To ModConn.c.RowCount-1
            ModConn.c.Position = i
            Id_Mantencion = ModConn.c.GetInt("id_evento")
            ID_QrMantencion = ModConn.c.GetInt("codigo_qr")
            Fecha_Creacion_Mantencion = ModConn.c.GetString("fecha_inicio")
            Mecanico_Encontrado = ModConn.c.GetString("mecanico")
        Next
       
        Msgbox2Async("Mantención encontrada:"& Chr(13)&Chr(10)&Chr(13)&Chr(10) & _
                    "Mecanico        : "&Mecanico_Encontrado& Chr(13)&Chr(10) & _
                    "Equipo                    : "&ID_QrMantencion& Chr(13)&Chr(10)& _
                    "Iniciado                : "&Fecha_Creacion_Mantencion& Chr(13)&Chr(10) & _
                    "Duración            : "&"?"& Chr(13)&Chr(10)&Chr(13)&Chr(10)& _
        "Desea cerrar?", "Alerta", "Si", "", "Cancelar", LoadBitmap(File.DirAssets, "warning.png"), False)
        Wait For Msgbox_Result (Result As Int)
        If Result = DialogResponse.POSITIVE Then
            GuardaActualizaMantencion
        End If

        If Result = DialogResponse.NEGATIVE Then
            Activity.Finish
        End If
    Else
        DialogMecanico
    End If
    ModConn.c.Close
    ModConn.s.TransactionSuccessful
    ModConn.s.EndTransaction
End Sub
 
Upvote 0
Top