We recently developed a game using cocos2d-js (3.17.1) for android & getting more number of ANR's,I want to understand how we can easily understand the stack trace reported.
I observed like some of the lines are bold & some of them are light gray why is that, each thread have some state, & some ANR's have warnings in yellow, but not getting which thread caused the problem.
Searched on google, gone through lot of posts,google play android docs, its just gives a information about what is mean of ANR, (main thread got blocked) and how to handle / prevent from ANR's, doesn't exactly get how can I extract meaning from stack trace, how to go through stack trace, which thread exactly caused the problem.
Full stack trace is here https://del.dog/unafalycej.txt
Attaching a screenshot of ANR which we got most number of time (main thread & blockes thread).
ANR title screenshot
main thread screenshot
blocked thread screenshot
With my experience ANRs are the most difficult to analyze, but below mentioned are some possible steps that I do RCA.
Keep looking for a specific action after which you see the ANR, look for its API/method/onClick
, try analyzing that code.
Look at the logs for these specific method, are there any unnecessary calls in between, try profiling if possible.
After a application experiences a ANR, android stores a at /data/anr/traces.txt
. Try pulling this file and start analyzing it. Look for main thread, check its STATE
and stacktrace. Refer this for details on traces file.
Trying identifying threads with large jiffies. See their call stack as well.
There also thread dump and systrace
like feature which can be useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With