Hi,

  I have implemented a slow search provider that queries my database. Now
when at the same time I do another read access my applications stalls (ANR).


  It's both read and I don't see why there should be a lock. What are my
options to get a little more concurrency here?

Cheers,
Mariano

Here are the two threads that block each other.

One:
"main" prio=5 tid=3 WAIT
  | group="main" sCount=1 dsCount=0 s=N obj=0x4001db08 self=0xbc48
  | sysTid=2680 nice=0 sched=0/0 handle=-1343996920
  at java.lang.Object.wait(Native Method)
  - waiting on <0x271f30> (a java.lang.VMThread)
  at java.lang.Thread.parkFor(Thread.java:1499)
  at java.lang.LangAccessImpl.parkFor(LangAccessImpl.java:48)
  at sun.misc.Unsafe.park(Unsafe.java:319)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:117)
  at
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:680)
  at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:710)
  at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1040)
  at
java.util.concurrent.locks.ReentrantLock$FairSync.lock(ReentrantLock.java:193)
  at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:252)
  at android.database.sqlite.SQLiteDatabase.lock(SQLiteDatabase.java:292)
  at
android.database.sqlite.SQLiteDatabase.addSQLiteClosable(SQLiteDatabase.java:221)
  at android.database.sqlite.SQLiteProgram.<i
nit>(SQLiteProgram.java:57)
  at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:49)
  at
android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:49)
  at
android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1118)
  at
android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1092)
  at com.newsrob.DB.findCursorByQueryString(DB.java:419)
  at com.newsrob.EntryManager.getArticleAsCursor(EntryManager.java:1010)
  at
com.newsrob.activities.ShowArticleActivity.onCreate(ShowArticleActivity.java:81)
  at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
  at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
  at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
  at android.app.ActivityThread.access$2100(ActivityThread.java:116)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4203)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
  at dalvik.system.NativeStart.main(Native Method)

Two:
"Binder Thread #4" prio=5 tid=17 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x432685c8 self=0x231ee8
  | sysTid=2690 nice=10 sched=0/0 handle=2315224
  at android.database.sqlite.SQLiteQuery.native_fill_window(Native Method)
  at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:75)
  at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:288)
  at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:269)
  at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:171)
  at android.database.AbstractCursor.moveToNext(AbstractCursor.java:256)
  at
com.newsrob.search.SearchProvider.getSuggestions(SearchProvider.java:80)
  at com.newsrob.search.SearchProvider.query(SearchProvider.java:68)
  at
android.content.ContentProvider$Transport.bulkQuery(ContentProvider.java:116)
  at
android.content.ContentProviderNative.onTransact(ContentProviderNative.java:97)
  at android.os.Binder.execTransact(Binder.java:287)
  at dalvik.system.NativeStart.run(Native Method)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to