- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 IntentService,用于将日志发送到我们的日志服务器。
我已经收到有关此应用程序在现场无缘无故退出的报告,没有 ANR,没有“不幸......”,只是无声的“崩溃到桌面”(这不是“崩溃” - crashlytics 没有 catch 它。应用程序就消失了,没有过渡动画或任何东西),这似乎是导致它的问题。偶尔我会收到一个 ANR 对话框,除了打断用户外,它似乎根本不会影响应用程序。
我已经研究了如何调试 ANR,但除了执行此服务时发生的情况外,似乎没有任何迹象表明会发生这些情况。
首先,我尝试转储 anr 跟踪。唯一看起来有问题的线程是这个线程,但它不知道 GCDaemon 试图锁定什么(full anr trace here):
"GCDaemon" daemon prio=5 tid=11 Blocked
| group="system" sCount=1 dsCount=0 obj=0x12c9c200 self=0xaf211400
| sysTid=12503 nice=0 cgrp=apps sched=0/0 handle=0xaf225a80
| state=S schedstat=( 2357890680 895472914 1619 ) utm=195 stm=40 core=0 HZ=100
| stack=0xb3c46000-0xb3c48000 stackSize=1036KB
| held mutexes=
native: #00 pc 00010110 /system/lib/libc.so (syscall+28)
native: #01 pc 000aad07 /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+82)
native: #02 pc 0012f793 /system/lib/libart.so (art::gc::Heap::WaitForConcurrentGCRequest(art::Thread*)+90)
native: #03 pc 000003db /system/framework/arm/boot.oat (Java_dalvik_system_VMRuntime_waitForConcurrentGCRequest__+82)
at dalvik.system.VMRuntime.waitForConcurrentGCRequest(Native method)
- waiting to lock an unknown object
at java.lang.Daemons$GCDaemon.run(Daemons.java:334)
at java.lang.Thread.run(Thread.java:818)
我已经尝试过严格模式,但是当对话框显示时我没有遇到任何严格模式违规,只有以下转储:
02-14 15:16:54.434 821-1014/? E/ActivityManager: ANR in com.myApp
PID: 26032
Reason: Executing service com.myApp/.services.LoggerService
Load: 11.8 / 12.09 / 12.38
CPU usage from 1377ms to -6213ms ago:
55% 821/system_server: 19% user + 36% kernel / faults: 9743 minor
5.9% 1758/com.google.android.gms: 3.1% user + 2.7% kernel / faults: 1739 minor
5.5% 1188/com.android.systemui: 2.9% user + 2.6% kernel / faults: 2141 minor
0% 287/debuggerd: 0% user + 0% kernel / faults: 2917 minor
3.9% 1461/com.android.phone: 1.5% user + 2.3% kernel / faults: 2380 minor
3.8% 26032/com.myApp: 2.2% user + 1.5% kernel / faults: 6809 minor
3% 4767/com.twotechnologies.n5service: 0.9% user + 2.1% kernel / faults: 860 minor
2.2% 212/dhd_dpc: 0% user + 2.2% kernel
1.7% 1542/com.sec.imsservice: 0.5% user + 1.1% kernel / faults: 1529 minor
0% 1455/com.android.nfc: 0% user + 0% kernel / faults: 701 minor
0.7% 19190/adbd: 0.1% user + 0.6% kernel / faults: 129 minor
0% 1447/com.android.server.telecom: 0% user + 0% kernel / faults: 803 minor
0% 2030/com.android.incallui: 0% user + 0% kernel / faults: 656 minor
0.6% 2246/mpdecision: 0.6% user + 0% kernel
0.6% 3069/mdnsd: 0.1% user + 0.5% kernel
0.5% 213/dhd_rxf: 0% user + 0.5% kernel
0% 2001/com.samsung.vmmhux: 0% user + 0% kernel / faults: 591 minor
0.3% 20989/kworker/u:3: 0% user + 0.3% kernel
0.2% 211/dhd_watchdog_th: 0% user + 0.2% kernel
0.2% 9206/kworker/0:0H: 0% user + 0.2% kernel
0.2% 22900/logcat: 0% user + 0.2% kernel
0.2% 25851/kworker/0:0: 0% user + 0.2% kernel
0.2% 26330/logcat: 0.1% user + 0.1% kernel
0.2% 26361/kworker/u:2: 0% user + 0.2% kernel
0% 1//init: 0% user + 0% kernel / faults: 20 minor
0.1% 2/kthreadd: 0% user + 0.1% kernel
0.1% 3/ksoftirqd/0: 0% user + 0.1% kernel
0.1% 7/kworker/u:0H: 0% user + 0.1% kernel
0.1% 33/kworker/u:1H: 0% user + 0.1% kernel
0.1% 171/cfinteractive: 0% user + 0.1% kernel
0.1% 205/mmcqd/1: 0% user + 0.1% kernel
0% 223/jbd2/mmcblk0p25: 0% user + 0% kernel
0.1% 256/surfaceflinger: 0.1% user + 0% kernel
0.1% 281/edmaudit: 0% user + 0.1% kernel
0.1% 1984/com.google.android.gms.persistent: 0.1% user + 0% kernel
0.1% 2583/com.vcast.mediamanager: 0% user + 0.1% kernel
0.1% 2874/tv.peel.samsung.app: 0% user + 0.1% kernel
0.1% 22944/perfd: 0% user + 0.1% kernel
+0% 28214/diag_uart_log: 0% user + 0% kernel
+0% 28215/migration/3: 0% user + 0% kernel
+0% 28216/kworker/3:0: 0% user + 0% kernel
+0% 28217/kworker/3:0H: 0% user + 0% kernel
+0% 28218/ksoftirqd/3: 0% user + 0% kernel
+0% 28219/kworker/3:1: 0% user + 0% kernel
+0% 28220/kworker/3:1H: 0% user + 0% kernel
58% TOTAL: 19% user + 35% kernel + 0% iowait + 3.5% softirq
CPU usage from 5173ms to 5712ms later:
16% 821/system_server: 3.3% user + 13% kernel / faults: 6 minor
13% 1014/ActivityManager: 3.3% user + 10% kernel
1.6% 835/FinalizerDaemon: 0% user + 1.6% kernel
2.1% 1758/com.google.android.gms: 2.1% user + 0% kernel / faults: 7 minor
1% 27483/mdns-receive: 1% user + 0% kernel
0.9% 1//init: 0% user + 0.9% kernel / faults: 9 minor
1.7% 212/dhd_dpc: 0% user + 1.7% kernel
1.1% 4767/com.twotechnologies.n5service: 1.1% user + 0% kernel / faults: 3 minor
1.1% 4789/b: 1.1% user + 0% kernel
1.1% 4790/h: 0% user + 1.1% kernel
+0% 28214/diag_uart_log: 0% user + 0% kernel
24% TOTAL: 5.4% user + 17% kernel + 1.3% softirq
我试过 ANRWatchDog:https://github.com/SalomonBrys/ANR-WatchDog当 ANR 对话框显示时,它不会抛出异常。
最后,我已经尝试从服务的 onHandleIntent 中删除所有逻辑,但我仍然经常收到 ANR 对话框。如同,这是服务的 onHandleIntent:
@Override
protected void onHandleIntent(Intent intent) {
}
我很难过。
最佳答案
我通过不使用 IntentService 并切换到一组触发 AsyncTasks 的静态方法来解决我的问题。我仍然不知道我最初问题的根本原因是什么。
关于android - 执行服务时莫名其妙的 ANR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48816281/
echo "Language"; echo " Select... English(US) English(AU)
好吧,我真的不知道为什么会这样。我目前正在实现一个线程容器,它以分离的方式运行无限循环,限制在每次迭代之间的特定速度。 标题: class timeloop { public: std::th
我收到 System.InvalidOperationException: Collection was modified;枚举操作可能无法执行: ExceptionLoggingLibrary.Lo
我是一名优秀的程序员,十分优秀!