-
Notifications
You must be signed in to change notification settings - Fork 407
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
Real ANR timeout #40
Comments
Another weird thing is that timeout in the constructor is |
Oh, it helped me figure out why obvious
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tested your library and I found that reaction on ANR is much bigger than the value set in constructor by
new ANRWatchDog(10000 /*timeout*/).start();
I found that it is caused by this code
If there is no ANR, your thread basically sleeps for 10000 ms in this case.
During this 10s can happen that thread is blocked, for example in the middle.
So it is already 5s blocked at the end, but tick has arrived before it happens.
So it will sleep again 10s, and then it detects ANR after 15s.
So theoretically it can be almost double of configured time.
The only workaround is to use low timeout interval, for example, 500ms
And then use
ANRInterceptor
and detect real 10s here.But this behavior is not clear from the documentation.
The text was updated successfully, but these errors were encountered: