Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding ANR stack trace given by google play

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

like image 245
Hatim.Developer Avatar asked Nov 07 '22 11:11

Hatim.Developer


1 Answers

With my experience ANRs are the most difficult to analyze, but below mentioned are some possible steps that I do RCA.

  1. Keep looking for a specific action after which you see the ANR, look for its API/method/onClick, try analyzing that code.

  2. Look at the logs for these specific method, are there any unnecessary calls in between, try profiling if possible.

  3. 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.

  4. Trying identifying threads with large jiffies. See their call stack as well.

  5. There also thread dump and systrace like feature which can be useful.

like image 52
Mangesh Pawar Avatar answered Nov 12 '22 19:11

Mangesh Pawar