-
Notifications
You must be signed in to change notification settings - Fork 834
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
Deadlock on main thread creating ANR in the app in MonitoringStatus.regions() #1108
Comments
Thanks for this report. I have been starting at the code for 30 minutes, but I can't see how a deadlock happened here. AFAICT, here is what is happening when this happens: The main thread received a new scan via intent, and tried to restore scan state to schedule a new scan job with this line Meanwhile, another thread was trying to start beacon ranging, which also caused that thread to try to restore scan state with the same call to So in summary:
Why is this a deadlock? I see no reason why the main thread cannot call the method on Unless there is another thread in the mix not shown in the screenshot? |
It is indeed eluding me too, thank you for your time. I managed to get my hands on 2 more exemples that I might help with context. Here is the first one:And here is the second one (2 different Screenshots)Finally, the 3rd one |
Could this happen if I try to scan using altbeacon while one of my imported lib did the same? |
While it is possible that contributes to the cause, but I don't think that would fundamentally change anything. Because the BeaconManger is a singleton it is shared by both your app and all libraries your app uses, so any problem like this might happen regardless of whether all calls are from your app or calls are also made from a dependent library. From the stack traces I have seen so far, I don't understand why the threads are blocked. There must be something wrong with my understanding about how |
Expected behavior
altbeacon would not block the main thread
Actual behavior
I can find a deadlock on the mainThread that creates ANR. You can find the lock in the screenshot below.
Steps to reproduce this behavior
I'm not sure, it's sporadic and I haven't reproduced it myself. II can see it in Firebase though.
Mobile device model and OS version
Android 12 - Galaxy A32
Android Beacon Library version
2.19.4
The text was updated successfully, but these errors were encountered: