How to Solve Google ANR report
So, I have an application which recently started to receive ANR's from goolge which says:
executing service com.trueconf.videochat/com.vc.service.AppNotificationService
And the logs of main thread are:
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 flags=1 obj=0x72cfe5e0 self=0xb0f04000
| sysTid=5344 nice=0 cgrp=default sched=0/0 handle=0xb4a004a8
| state=S schedstat=( 662123421 313268952 1450 ) utm=45 stm=21 core=4 HZ=100
| stack=0xbe303000-0xbe305000 stackSize=8MB
| held mutexes=
#00 pc 000000000004a75c /system/lib/libc.so (read+8)
#01 pc 000000000001f825 /system/lib/libjavacore.so (???)
#02 pc 0000000000208781 /system/framework/arm/boot-core-libart.oat (Java_libcore_io_Linux_readBytes__Ljava_io_FileDescriptor_2Ljava_lang_Object_2II+128)
at libcore.io.Linux.readBytes (Native method)
at libcore.io.Linux.read (Linux.java:182)
at libcore.io.BlockGuardOs.read (BlockGuardOs.java:251)
at libcore.io.IoBridge.read (IoBridge.java:528)
at java.io.FileInputStream.read (FileInputStream.java:254)
at java.io.BufferedInputStream.read1 (BufferedInputStream.java:286)
at java.io.BufferedInputStream.read (BufferedInputStream.java:347)
- locked <0x01d2acc7> (a java.lang.UNIXProcess$ProcessPipeInputStream)
at java.io.FilterInputStream.read (FilterInputStream.java:107)
at com.vc.utils.log.AdbHelper.saveCommandLog (AdbHelper.java:53)
at com.vc.utils.log.AdbHelper.saveNetStatLog (AdbHelper.java:29)
at com.vc.utils.file.AppFilesHelper.collectFilles (AppFilesHelper.java:269)
at com.vc.gui.activities.CrashReport$3.onReceived (CrashReport.java:207)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:123)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:25)
at android.os.AsyncTask.finish (AsyncTask.java:695)
at android.os.AsyncTask.-wrap1 (AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage (AsyncTask.java:712)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6565)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)
I suspect that the reason of ANR is long file reading operation, because last method in stack is Linux.readBytes() (correct me if I'm wrong) and I don't really get what is the connection between ANR and com.trueconf.videochat/com.vc.service.AppNotificationService service. This part of stack shows that application had an exception:
at com.vc.utils.log.AdbHelper.saveCommandLog (AdbHelper.java:53)
at com.vc.utils.log.AdbHelper.saveNetStatLog (AdbHelper.java:29)
at com.vc.utils.file.AppFilesHelper.collectFilles (AppFilesHelper.java:269)
at com.vc.gui.activities.CrashReport$3.onReceived (CrashReport.java:207)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:123)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:25)
And last method in this stack - AdbHelper.saveCommandLog(), looks like this:
private static void saveCommandLog(String targetFile, String command, String customInfo) {
byte buf = new byte[LogSaveHelper.TEN_K];
FileOutputStream logOutputStream = null;
InputStream commandInputStream = null;
File logFile = LogSaveHelper.getCustomLogFile(targetFile);
if (logFile != null) {
try {
logOutputStream = new FileOutputStream(logFile);
Process commandProc = Runtime.getRuntime().exec(command);
writeStringToStream(logOutputStream, customInfo);
commandInputStream = commandProc.getInputStream();
int numRead;
while ((numRead = commandInputStream.read(buf)) >= 0) {
logOutputStream.write(buf, 0, numRead);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (commandInputStream != null) {
try {
commandInputStream.close();
commandInputStream = null;
} catch (IOException e) {
commandInputStream = null;
}
}
if (logOutputStream != null) {
try {
logOutputStream.flush();
logOutputStream.close();
logOutputStream = null;
} catch (IOException e) {
logOutputStream = null;
}
}
}
}
}
So my question is: should I just move this saveCommandLog() method to backgorund thread? And why is AppNotificationService is mentioned in report if it has absolutely no connection to calling this method - it's getting called from activity CrashReportScreen.
android
add a comment |
So, I have an application which recently started to receive ANR's from goolge which says:
executing service com.trueconf.videochat/com.vc.service.AppNotificationService
And the logs of main thread are:
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 flags=1 obj=0x72cfe5e0 self=0xb0f04000
| sysTid=5344 nice=0 cgrp=default sched=0/0 handle=0xb4a004a8
| state=S schedstat=( 662123421 313268952 1450 ) utm=45 stm=21 core=4 HZ=100
| stack=0xbe303000-0xbe305000 stackSize=8MB
| held mutexes=
#00 pc 000000000004a75c /system/lib/libc.so (read+8)
#01 pc 000000000001f825 /system/lib/libjavacore.so (???)
#02 pc 0000000000208781 /system/framework/arm/boot-core-libart.oat (Java_libcore_io_Linux_readBytes__Ljava_io_FileDescriptor_2Ljava_lang_Object_2II+128)
at libcore.io.Linux.readBytes (Native method)
at libcore.io.Linux.read (Linux.java:182)
at libcore.io.BlockGuardOs.read (BlockGuardOs.java:251)
at libcore.io.IoBridge.read (IoBridge.java:528)
at java.io.FileInputStream.read (FileInputStream.java:254)
at java.io.BufferedInputStream.read1 (BufferedInputStream.java:286)
at java.io.BufferedInputStream.read (BufferedInputStream.java:347)
- locked <0x01d2acc7> (a java.lang.UNIXProcess$ProcessPipeInputStream)
at java.io.FilterInputStream.read (FilterInputStream.java:107)
at com.vc.utils.log.AdbHelper.saveCommandLog (AdbHelper.java:53)
at com.vc.utils.log.AdbHelper.saveNetStatLog (AdbHelper.java:29)
at com.vc.utils.file.AppFilesHelper.collectFilles (AppFilesHelper.java:269)
at com.vc.gui.activities.CrashReport$3.onReceived (CrashReport.java:207)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:123)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:25)
at android.os.AsyncTask.finish (AsyncTask.java:695)
at android.os.AsyncTask.-wrap1 (AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage (AsyncTask.java:712)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6565)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)
I suspect that the reason of ANR is long file reading operation, because last method in stack is Linux.readBytes() (correct me if I'm wrong) and I don't really get what is the connection between ANR and com.trueconf.videochat/com.vc.service.AppNotificationService service. This part of stack shows that application had an exception:
at com.vc.utils.log.AdbHelper.saveCommandLog (AdbHelper.java:53)
at com.vc.utils.log.AdbHelper.saveNetStatLog (AdbHelper.java:29)
at com.vc.utils.file.AppFilesHelper.collectFilles (AppFilesHelper.java:269)
at com.vc.gui.activities.CrashReport$3.onReceived (CrashReport.java:207)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:123)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:25)
And last method in this stack - AdbHelper.saveCommandLog(), looks like this:
private static void saveCommandLog(String targetFile, String command, String customInfo) {
byte buf = new byte[LogSaveHelper.TEN_K];
FileOutputStream logOutputStream = null;
InputStream commandInputStream = null;
File logFile = LogSaveHelper.getCustomLogFile(targetFile);
if (logFile != null) {
try {
logOutputStream = new FileOutputStream(logFile);
Process commandProc = Runtime.getRuntime().exec(command);
writeStringToStream(logOutputStream, customInfo);
commandInputStream = commandProc.getInputStream();
int numRead;
while ((numRead = commandInputStream.read(buf)) >= 0) {
logOutputStream.write(buf, 0, numRead);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (commandInputStream != null) {
try {
commandInputStream.close();
commandInputStream = null;
} catch (IOException e) {
commandInputStream = null;
}
}
if (logOutputStream != null) {
try {
logOutputStream.flush();
logOutputStream.close();
logOutputStream = null;
} catch (IOException e) {
logOutputStream = null;
}
}
}
}
}
So my question is: should I just move this saveCommandLog() method to backgorund thread? And why is AppNotificationService is mentioned in report if it has absolutely no connection to calling this method - it's getting called from activity CrashReportScreen.
android
add a comment |
So, I have an application which recently started to receive ANR's from goolge which says:
executing service com.trueconf.videochat/com.vc.service.AppNotificationService
And the logs of main thread are:
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 flags=1 obj=0x72cfe5e0 self=0xb0f04000
| sysTid=5344 nice=0 cgrp=default sched=0/0 handle=0xb4a004a8
| state=S schedstat=( 662123421 313268952 1450 ) utm=45 stm=21 core=4 HZ=100
| stack=0xbe303000-0xbe305000 stackSize=8MB
| held mutexes=
#00 pc 000000000004a75c /system/lib/libc.so (read+8)
#01 pc 000000000001f825 /system/lib/libjavacore.so (???)
#02 pc 0000000000208781 /system/framework/arm/boot-core-libart.oat (Java_libcore_io_Linux_readBytes__Ljava_io_FileDescriptor_2Ljava_lang_Object_2II+128)
at libcore.io.Linux.readBytes (Native method)
at libcore.io.Linux.read (Linux.java:182)
at libcore.io.BlockGuardOs.read (BlockGuardOs.java:251)
at libcore.io.IoBridge.read (IoBridge.java:528)
at java.io.FileInputStream.read (FileInputStream.java:254)
at java.io.BufferedInputStream.read1 (BufferedInputStream.java:286)
at java.io.BufferedInputStream.read (BufferedInputStream.java:347)
- locked <0x01d2acc7> (a java.lang.UNIXProcess$ProcessPipeInputStream)
at java.io.FilterInputStream.read (FilterInputStream.java:107)
at com.vc.utils.log.AdbHelper.saveCommandLog (AdbHelper.java:53)
at com.vc.utils.log.AdbHelper.saveNetStatLog (AdbHelper.java:29)
at com.vc.utils.file.AppFilesHelper.collectFilles (AppFilesHelper.java:269)
at com.vc.gui.activities.CrashReport$3.onReceived (CrashReport.java:207)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:123)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:25)
at android.os.AsyncTask.finish (AsyncTask.java:695)
at android.os.AsyncTask.-wrap1 (AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage (AsyncTask.java:712)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6565)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)
I suspect that the reason of ANR is long file reading operation, because last method in stack is Linux.readBytes() (correct me if I'm wrong) and I don't really get what is the connection between ANR and com.trueconf.videochat/com.vc.service.AppNotificationService service. This part of stack shows that application had an exception:
at com.vc.utils.log.AdbHelper.saveCommandLog (AdbHelper.java:53)
at com.vc.utils.log.AdbHelper.saveNetStatLog (AdbHelper.java:29)
at com.vc.utils.file.AppFilesHelper.collectFilles (AppFilesHelper.java:269)
at com.vc.gui.activities.CrashReport$3.onReceived (CrashReport.java:207)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:123)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:25)
And last method in this stack - AdbHelper.saveCommandLog(), looks like this:
private static void saveCommandLog(String targetFile, String command, String customInfo) {
byte buf = new byte[LogSaveHelper.TEN_K];
FileOutputStream logOutputStream = null;
InputStream commandInputStream = null;
File logFile = LogSaveHelper.getCustomLogFile(targetFile);
if (logFile != null) {
try {
logOutputStream = new FileOutputStream(logFile);
Process commandProc = Runtime.getRuntime().exec(command);
writeStringToStream(logOutputStream, customInfo);
commandInputStream = commandProc.getInputStream();
int numRead;
while ((numRead = commandInputStream.read(buf)) >= 0) {
logOutputStream.write(buf, 0, numRead);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (commandInputStream != null) {
try {
commandInputStream.close();
commandInputStream = null;
} catch (IOException e) {
commandInputStream = null;
}
}
if (logOutputStream != null) {
try {
logOutputStream.flush();
logOutputStream.close();
logOutputStream = null;
} catch (IOException e) {
logOutputStream = null;
}
}
}
}
}
So my question is: should I just move this saveCommandLog() method to backgorund thread? And why is AppNotificationService is mentioned in report if it has absolutely no connection to calling this method - it's getting called from activity CrashReportScreen.
android
So, I have an application which recently started to receive ANR's from goolge which says:
executing service com.trueconf.videochat/com.vc.service.AppNotificationService
And the logs of main thread are:
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 flags=1 obj=0x72cfe5e0 self=0xb0f04000
| sysTid=5344 nice=0 cgrp=default sched=0/0 handle=0xb4a004a8
| state=S schedstat=( 662123421 313268952 1450 ) utm=45 stm=21 core=4 HZ=100
| stack=0xbe303000-0xbe305000 stackSize=8MB
| held mutexes=
#00 pc 000000000004a75c /system/lib/libc.so (read+8)
#01 pc 000000000001f825 /system/lib/libjavacore.so (???)
#02 pc 0000000000208781 /system/framework/arm/boot-core-libart.oat (Java_libcore_io_Linux_readBytes__Ljava_io_FileDescriptor_2Ljava_lang_Object_2II+128)
at libcore.io.Linux.readBytes (Native method)
at libcore.io.Linux.read (Linux.java:182)
at libcore.io.BlockGuardOs.read (BlockGuardOs.java:251)
at libcore.io.IoBridge.read (IoBridge.java:528)
at java.io.FileInputStream.read (FileInputStream.java:254)
at java.io.BufferedInputStream.read1 (BufferedInputStream.java:286)
at java.io.BufferedInputStream.read (BufferedInputStream.java:347)
- locked <0x01d2acc7> (a java.lang.UNIXProcess$ProcessPipeInputStream)
at java.io.FilterInputStream.read (FilterInputStream.java:107)
at com.vc.utils.log.AdbHelper.saveCommandLog (AdbHelper.java:53)
at com.vc.utils.log.AdbHelper.saveNetStatLog (AdbHelper.java:29)
at com.vc.utils.file.AppFilesHelper.collectFilles (AppFilesHelper.java:269)
at com.vc.gui.activities.CrashReport$3.onReceived (CrashReport.java:207)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:123)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:25)
at android.os.AsyncTask.finish (AsyncTask.java:695)
at android.os.AsyncTask.-wrap1 (AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage (AsyncTask.java:712)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6565)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)
I suspect that the reason of ANR is long file reading operation, because last method in stack is Linux.readBytes() (correct me if I'm wrong) and I don't really get what is the connection between ANR and com.trueconf.videochat/com.vc.service.AppNotificationService service. This part of stack shows that application had an exception:
at com.vc.utils.log.AdbHelper.saveCommandLog (AdbHelper.java:53)
at com.vc.utils.log.AdbHelper.saveNetStatLog (AdbHelper.java:29)
at com.vc.utils.file.AppFilesHelper.collectFilles (AppFilesHelper.java:269)
at com.vc.gui.activities.CrashReport$3.onReceived (CrashReport.java:207)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:123)
at com.vc.tasks.SaveLogTask.onPostExecute (SaveLogTask.java:25)
And last method in this stack - AdbHelper.saveCommandLog(), looks like this:
private static void saveCommandLog(String targetFile, String command, String customInfo) {
byte buf = new byte[LogSaveHelper.TEN_K];
FileOutputStream logOutputStream = null;
InputStream commandInputStream = null;
File logFile = LogSaveHelper.getCustomLogFile(targetFile);
if (logFile != null) {
try {
logOutputStream = new FileOutputStream(logFile);
Process commandProc = Runtime.getRuntime().exec(command);
writeStringToStream(logOutputStream, customInfo);
commandInputStream = commandProc.getInputStream();
int numRead;
while ((numRead = commandInputStream.read(buf)) >= 0) {
logOutputStream.write(buf, 0, numRead);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (commandInputStream != null) {
try {
commandInputStream.close();
commandInputStream = null;
} catch (IOException e) {
commandInputStream = null;
}
}
if (logOutputStream != null) {
try {
logOutputStream.flush();
logOutputStream.close();
logOutputStream = null;
} catch (IOException e) {
logOutputStream = null;
}
}
}
}
}
So my question is: should I just move this saveCommandLog() method to backgorund thread? And why is AppNotificationService is mentioned in report if it has absolutely no connection to calling this method - it's getting called from activity CrashReportScreen.
android
android
edited Nov 20 '18 at 20:28
Danil.B
asked Nov 20 '18 at 20:19
Danil.BDanil.B
869
869
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53400907%2fhow-to-solve-google-anr-report%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53400907%2fhow-to-solve-google-anr-report%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown