我收到此警告消息,由于我看到此消息,我也开始看到Google Play 服务没有响应弹出窗口,并且它会在一段时间后关闭我的应用程序。我已经审查了类似的问题,但找不到原因。
以下是我的处理程序线程使用示例。我不知道该怎么做才能避免这个问题。
@Override
public void find(Func1<RealmQuery<Artist>, RealmQuery<Artist>> query,
Action1<Result<List<Artist>>> onResult) {
if (query != null) {
handlerThread = new HandlerThread("MyHandlerThreadArtist");
handlerThread.start();
looper = handlerThread.getLooper();
Handler handler = new Handler(looper);
handler.post(new Runnable(){
@Override
public void run() {
Timber.log(Log.DEBUG, "ARTISTDAOIMPL", "find Thread.currentThread().getName() " + Thread.currentThread().getName());
mDatabase.findRealmObject(Artist.class, query,
result -> onResult.call(
Result.getData(Arrays.asList(result.data.toArray(new Artist[]{})))
), err -> onResult.call(Result.getError(err))
);
}
});
}
12-17 15:56:44.631 2944 2977 W art : Long monitor contention with owner Answers Events Handler1 (2983) at java.lang.Object java.lang.Throwable.nativeFillInStackTrace!()(Throwable.java:-2) waiters=0 in io.fabric.sdk.android.services.common.AdvertisingInfo io.fabric.sdk.android.services.common.IdManager.getAdvertisingInfo() for 274ms
我使用织物来获取崩溃报告。不确定它是否与此有关。这部分来自显示有关Answers Events Handler1traces.txt
的信息的文件,我认为这会有所帮助。
"Answers Events Handler1" prio=5 tid=21 Waiting
| group="main" sCount=1 dsCount=0 obj=0x12ca50d0 self=0x9fe5b200
| sysTid=32081 nice=10 cgrp=default sched=0/0 handle=0x9307f920
| state=S schedstat=( 53200042 321330653 137 ) utm=2 stm=3 core=2 HZ=100
| stack=0x92f7d000-0x92f7f000 stackSize=1038KB
| held mutexes=
at java.lang.Object.wait!(Native method)
- waiting on <0x0b62dbce> (a java.lang.Object)
at java.lang.Thread.parkFor$(Thread.java:2127)
- locked <0x0b62dbce> (a java.lang.Object)
at sun.misc.Unsafe.park(Unsafe.java:325)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:161)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2035)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1091)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1084)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1058)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1118)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:75)
at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
at java.lang.Thread.run(Thread.java:761)
这是另一个类似警告:
12-17 15:16:05.729 32041 32084 W art : Long monitor contention with owner Queue (32074) at boolean android.os.BinderProxy.transactNative(int, android.os.Parcel, android.os.Parcel, int)(Binder.java:-2) waiters=1 in io.fabric.sdk.android.services.common.AdvertisingInfo io.fabric.sdk.android.services.common.IdManager.getAdvertisingInfo() for 267ms
这部分也来自traces.txt
关于“队列”的文件:
"Queue" prio=10 tid=20 Waiting
| group="main" sCount=1 dsCount=0 obj=0x12c56280 self=0x9fe5ad00
| sysTid=32077 nice=10 cgrp=default sched=0/0 handle=0x93249920
| state=S schedstat=( 2336754 827421 7 ) utm=0 stm=0 core=0 HZ=100
| stack=0x93147000-0x93149000 stackSize=1038KB
| held mutexes=
at java.lang.Object.wait!(Native method)
- waiting on <0x061c78c9> (a java.lang.Object)
at java.lang.Thread.parkFor$(Thread.java:2127)
- locked <0x061c78c9> (a java.lang.Object)
at sun.misc.Unsafe.park(Unsafe.java:325)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:161)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2035)
at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:519)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.performOperation(DependencyPriorityBlockingQueue.java:197)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.get(DependencyPriorityBlockingQueue.java:236)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:65)
at io.fabric.sdk.android.services.concurrency.DependencyPriorityBlockingQueue.take(DependencyPriorityBlockingQueue.java:46)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1058)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1118)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
首先,它显示了我在应用程序中使用的特定处理程序线程名称。目前它没有显示它们,但它会打印这些。
我需要了解这是否是一个大问题以及如何解决它们。
谢谢。