Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main thread is in runnable state but still ANR is detected. #55

Closed
kshitiz-dunzo opened this issue Aug 16, 2021 · 1 comment
Closed

Comments

@kshitiz-dunzo
Copy link

Hello,
We integrated your library and we are seeing some weird logs on our crashlytics, like below:

Caused by com.github.anrwatchdog.ANRError$$$_Thread
main (state = RUNNABLE)

The state is runnable but it still shows up as an ANR. Is this a false positive?

@SalomonBrys
Copy link
Owner

I don't think so.
ANRWatchDog works a very simple way : it schedules a "ticker" to be run on the UI thread ASAP, and waits 5 seconds to check if the ticker was ran. If it wasn't, it means that the UI thread is blocked (or more precisely, hasn't been able to run a posted Handler for 5 seconds).

There are multiple reasons the UI thread may be blocked and still in the RUNNABLE state : infinite loop, complex calculations, etc.

You should check the stack trace of the main thread, it should be an indication of what it was doing, and why it cannot run the ticker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants