RushOrm icon indicating copy to clipboard operation
RushOrm copied to clipboard

ANR in AndroidRushQueProvider.blockForNextQue

Open fabsimilian opened this issue 9 years ago • 1 comments

We have some ANRs in our Project due to rush queue:

DALVIK THREADS (38):
"main" prio=5 tid=1 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x759306c8 self=0xb4f07800
  | sysTid=17679 nice=0 cgrp=apps sched=0/0 handle=0xb6fa1ec8
  | state=S schedstat=( 0 0 0 ) utm=310 stm=39 core=0 HZ=100
  | stack=0xbe1e7000-0xbe1e9000 stackSize=8MB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x10a7e948> (a java.lang.Object)
  at co.uk.rushorm.android.AndroidRushQueProvider.blockForNextQue(AndroidRushQueProvider.java:26)
  - locked <0x10a7e948> (a java.lang.Object)
  at co.uk.rushorm.core.RushCore.load(RushCore.java:256)
  at co.uk.rushorm.core.RushSearch.find(RushSearch.java:41)

Any ideas how to fix this?

fabsimilian avatar Dec 10 '15 12:12 fabsimilian

Looks like you might need to use the async methods for saves and loads.

Async save is done by calling

object.save(new RushCallback() {
    @Override
    public void complete() {
        /* Callback is on the thread objects where saved on, 
            not thread that called save */
    }
});

You can use a null callback if you don't care about the response.

There is also an async load method on RushSearch. Just need to watch as the callback is not in the main thread.

Cheers

Stuart-campbell avatar Dec 14 '15 19:12 Stuart-campbell