-
Notifications
You must be signed in to change notification settings - Fork 11
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
Android ANR caused by graphics conflict with Chromium? #3549
Comments
Hi @ajwfrost I was not able to reproduce it and can't precise what causing the problem. Here is logcat from Android 14 test device (Pixel 8 pro): Problem described in google play console: Also they point to this link: https://developer.android.com/topic/performance/anrs/find-unresponsive-thread#lock-contention Regards |
My findings are similar to what Hadisn is reporting Reporting ANRs in my app Rendermode=direct Findings: As we can see there is big difference Hope it can be solved soon . Thanks in advance |
Hi Quick update here is that we looked again at the stack dumps and where the different threads are, and the issue does seem to be related to the GPU and its usage across different theads. The main thread is trying to render; meanwhile the AIR thread is trying to do a 'make current', and the Chromium webview seems to have one thread trying to render and another thread waiting on something... About the only thing we can control here is to merge the main/UI thread with the runtime thread i.e. remove that "runtimeInBackgroundThread" setting. Would it be possible to try that, and see if it impacts the ANR rate? If you're still getting ANRs with that, it would be good if we can get another dump file with the thread stacks to see whereabouts things are hanging. Given it seems to be related to the Android version (14) per the above, I'm wondering if there's a change in the Android WebView component that could be behind this.. thanks
|
So I also have a spike in this ANRs mostly, for MT6855 and MT6765 stacktrace.log.txt I have blocked certain devices from google play to avoid breaking bad thresold. I dont like disbling |
Hi @ajwfrost, thank you for update. I agree with @bobrokrol RuntinmeInBackground=true solved a lot of problems except these few and I believe that this will be also fixed. |
Hi @ajwfrost, I see that AIR 51.1.2.2 is released, can you just tell us should we enable or disable Thank you |
Hi The updates in 51.1.2.2 were around some of the other API calls that seemed to result in crashes when using the background thread model - i.e. an actual crash due to state error, rather than just a hang / ANR like you're seeing here. So I don't expect this version to change anything regarding the conflict we have here with Chromium. My hope had been that it would be possible to see whether switching back to using the UI thread for AIR would then show whether we have a fundamental problem with Chromium interactions, or whether that was just a side-effect of having the extra thread. But if it causes increased ANRs in other areas without the background mode, then it might be tricky (or counter-productive) to check this. So currently, we're at the same position: we seem to have an odd conflict when using Chromium (but only on certain chipsets?) and we don't know whether or not it's related to the background runtime mode. thanks |
I will upload version with |
Hi @ajwfrost, two days ago I uploaded version with "The main thread is blocked, waiting on a native synchronization routine, such as a mutex." |
Okay thanks -- and it still looks like we have the same problem:
Some interesting information about how Chromium works on Android: This might be the issue: from what I'm reading, it might be that Android needs only a single EGL context for a window/surface. It is (I think) possible to have multiple EGL contexts by having multiple Activities. So just to check on the use case here:
thanks |
|
I think different apps may have different cases. I think we can't stop using direct/gpu mode. So about a separate activity for webview - can it be a manifest flag or code param? So everyone may choose and know limitations. By the way what limitations for us with separate webview activity?) |
Judging by the use cases here, it doesn't sound like we can solve this by pushing the use of a WebView into a separate activity. Particularly because there are third party components and other considerations - especially around advertising - that may still need to stick within this AIR-based activity. So instead we are wondering whether the whole Android rendering mechanism may need to change, so that we use this differently. Currently, we have a SurfaceView and get the holder in order to manually create an EGL surface object. That all works fine .. but it's not what Android recommend now when setting up a new application, instead they have a GLSurfaceView component that specifies a separate rendering thread for the GPU activities - which is I believe the thread that we're seeing here from the Chromium library, with the GLES/EGL conflicts. All Android devices since 4.0.3 support OpenGL ES 2.0 so there's no reason why we can't actually drop the "cpu" render mode support on Android and switch that over to "direct" mode i.e. rendering of normal display list remains using the CPU/SIMD operations, but composition happens using OpenGL ES. I think that this may help in this scenario, as well as possibly improving our "runtime in background thread" concept (because the implication would be that the AIR runtime would need to sit in this rendering thread too). The downside - this could be quite a bit of work with a high risk of regression. We'll have a bit of a discussion internally about it, I suspect the benefits will outweigh the challenges though... thanks |
See https://github.com/distriqt/ANE-Adverts/issues/589#issuecomment-2442319673
There's an ANR showing up in the log (attached). Initial thoughts are below:
libc.so.__futex_wait_ex.log
The ANR looks like it's GPU-related:
"main" (tid 1) = Android UI:
"Thread 4" (tid 25) = AIR runtime:
Which might mean there's a conflict between these two threads ...
Although threre's also a Chromium instance in tid 71 which appears to also be waiting:
plus I'm curious what triggered
"JavaBridge" tid=73 Native
- this is also in a function that perhaps is blocking.And then I've just scrolled down further and found there is a "RenderThread" (tid 100) for the Chromium instance which then seems to be somehow calling back into the AIR runtime..?!
@hadisn are you able to reproduce the ANR yourselves? Do you know if there's anything in particular that's causing the problem e.g. a particular screen when you then tap in a particular place? I think we'll need to look more into this one - what version of the AIR SDK were you using for this?
thanks
The text was updated successfully, but these errors were encountered: