Skip to content

SQLiteCursor locking issue on close #97

Closed
@madhu314

Description

@madhu314

In my application which uses a cursorloader I am running into ANR and this is what the trace file looks like. What I am trying to understand here is that why would a main thread which is trying to close the cursor get blocked on itself. This issue happens randomly and I have not yet figured out a reproducible scenario. I am doubting if this is locking issue associated with sqlcipher's cursor implementation.

"main" prio=5 tid=1 WAIT
| group="main" sCount=1 dsCount=0 obj=0x415979a0 self=0x4000b010
| sysTid=9804 nice=0 sched=0/0 cgrp=apps handle=1075102172
| state=S schedstat=( 0 0 0 ) utm=3670 stm=710 core=1
at java.lang.Object.wait(Native Method)

  • waiting on <0x41597da0> (a java.lang.VMThread) held by tid=1 (main)
    at java.lang.Thread.parkFor(Thread.java:1231)
    at sun.misc.Unsafe.park(Unsafe.java:323)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:159)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:810)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:843)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1173)
    at java.util.concurrent.locks.ReentrantLock$FairSync.lock(ReentrantLock.java:198)
    at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:259)
    at net.sqlcipher.database.SQLiteDatabase.lock(SQLiteDatabase.java:460)
    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 android.database.CursorWrapper.close(CursorWrapper.java:49)
    at android.database.CursorWrapper.close(CursorWrapper.java:49)
    at android.content.ContentResolver$CursorWrapperInner.close(ContentResolver.java:1860)
    at android.database.MergeCursor.close(MergeCursor.java:175)
    at android.database.CursorWrapper.close(CursorWrapper.java:49)
    at android.content.CursorLoader.deliverResult(CursorLoader.java:117)
    at android.content.CursorLoader.deliverResult(CursorLoader.java:43)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions