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

ANR happens with arm64-v8a apk #755

Closed
xzhan96 opened this issue Jan 29, 2019 · 3 comments
Closed

ANR happens with arm64-v8a apk #755

xzhan96 opened this issue Jan 29, 2019 · 3 comments
Assignees
Labels
android Issue/feature request for Android only bug Something isn't working

Comments

@xzhan96
Copy link

xzhan96 commented Jan 29, 2019

Describe the bug
If only build arm64-v8a target sample(image-based-lighting) apk, the anr happens in some devices:

  • Google Pixel2 XL and Huawei Mate 20/pro can reproduce.
  • Samsang galaxy c7 pro seems not reproduce.

To Reproduce
Steps to reproduce the behavior:

  1. follow the step in https://github.com/google/filament to build android ARM 64-bit target (arm64-v8a).
  2. Import image-based-lighting sample into android studio, and change productFlavors in app/build.gradle as below, only use arm64-v8a.
    productFlavors {
    arm8 {
    dimension 'cpuArch'
    ndk {
    abiFilters 'arm64-v8a'
    }
    }
  3. Build and run the apk, anr happens after a few seconds.

Expected behavior
The apk should runs well

Smartphone (please complete the following information):

  • Device: [Pixel 2 XL and Huawei Mate20/20pro]
  • OS: [Android Pie 9.0]

Additional context
ANR logs as below:
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 flags=1 obj=0x758918f0 self=0x7d98a14c00
| sysTid=8779 nice=-4 cgrp=default sched=0/0 handle=0x7e1f12f548
| state=S schedstat=( 328631778 11113018 529 ) utm=26 stm=6 core=1 HZ=100
| stack=0x7fe72eb000-0x7fe72ed000 stackSize=8MB
| held mutexes=
kernel: __switch_to+0x9c/0xc0
kernel: futex_wait_queue_me+0xcc/0x144
kernel: futex_wait+0xe4/0x1a0
kernel: do_futex+0x190/0x548
kernel: SyS_futex+0x134/0x1d4
kernel: __sys_trace+0x4c/0x4c
native: #00 pc 000000000001f3ec /system/lib64/libc.so (syscall+28)
native: #1 pc 00000000000905d8 /data/app/com.google.android.filament.ibl-m0lYnrjI-SnIkOOjzTfTNg==/lib/arm64/libfilament-jni.so (utils::Condition::wait_until(utils::Mutex*, bool, timespec*)+104)
at com.google.android.filament.Renderer.nEndFrame(Native method)
at com.google.android.filament.Renderer.endFrame(Renderer.java:49)
at com.google.android.filament.ibl.MainActivity$FrameCallback.doFrame(MainActivity.kt:270)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1077)
at android.view.Choreographer.doCallbacks(Choreographer.java:885)
at android.view.Choreographer.doFrame(Choreographer.java:806)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1065)
at android.os.Handler.handleCallback(Handler.java:891)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:7470)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)

@romainguy
Copy link
Collaborator

Thank you for the report! We were just tracking a similar issue.

@romainguy romainguy added bug Something isn't working android Issue/feature request for Android only sceneform labels Jan 29, 2019
@romainguy
Copy link
Collaborator

I can reproduce the issue very easily, thanks.

@romainguy
Copy link
Collaborator

Here is the stack in debug, it looks like the job system has a bug in waitAndRelease:

"main" prio=5 tid=1 Native
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x7599da78 self=0x7620e14c00
  | sysTid=8701 nice=-4 cgrp=default sched=0/0 handle=0x76a6972548
  | state=S schedstat=( 7315952965 691748308 15568 ) utm=575 stm=155 core=4 HZ=100
  | stack=0x7ffad71000-0x7ffad73000 stackSize=8MB
  | held mutexes=
  kernel: __switch_to+0xac/0xb8
  kernel: futex_wait_queue_me+0xc4/0x12c
  kernel: futex_wait+0xe8/0x2d0
  kernel: do_futex+0xf8/0x1408
  kernel: SyS_futex+0x144/0x19c
  kernel: __sys_trace_return+0x0/0x4
  native: #00 pc 000000000001ed2c  /system/lib64/libc.so (syscall+28)
  native: #01 pc 000000000028ffb4  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (utils::linuxutil::futex(void volatile*, int, int, timespec const*, int)+68)
  native: #02 pc 000000000028ff00  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (utils::linuxutil::futex_wait_ex(void volatile*, bool, int, bool, timespec const*)+112)
  native: #03 pc 000000000028fc54  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (utils::Condition::wait_until(utils::Mutex*, bool, timespec*)+244)
  native: #04 pc 000000000018f7d8  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (utils::Condition::wait(std::__ndk1::unique_lock<utils::Mutex>&)+56)
  native: #05 pc 0000000000282f1c  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (utils::JobSystem::waitAndRelease(utils::JobSystem::Job*&)+668)
  native: #06 pc 0000000000283038  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (utils::JobSystem::runAndWait(utils::JobSystem::Job*&)+56)
  native: #07 pc 00000000001640b0  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (filament::details::FEngine::gc()+688)
  native: #08 pc 00000000001aaa88  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (_ZNSt6__ndk128__invoke_void_return_wrapperIvE6__callIJRNS_6__bindIMN8filament7details7FEngineEFvvEJPS6_EEEEEEvDpOT_+248)
  native: #09 pc 00000000001aa8d0  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (_ZNSt6__ndk110__function6__funcINS_6__bindIMN8filament7details7FEngineEFvvEJPS5_EEENS_9allocatorIS9_EEFvvEEclEv+48)
  native: #10 pc 0000000000183180  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (std::__ndk1::function<void ()>::operator()() const+160)
  native: #11 pc 00000000001aaabc  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (_ZZN5utils4jobs9createJobIMN8filament7details7FEngineEFvvEPS4_JEvEEPNS_9JobSystem3JobERS8_SA_OT_OT0_DpOT1_EN4Data3gobESB_SA_+28)
  native: #12 pc 00000000001aab54  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (_ZZN5utils9JobSystem9createJobIZNS_4jobs9createJobIMN8filament7details7FEngineEFvvEPS6_JEvEEPNS0_3JobERS0_SB_OT_OT0_DpOT1_E4DataXadL_ZZNS3_IS8_S9_JEvEESB_SC_SB_SE_SG_SJ_ENSK_3gobESC_SB_EEEESB_SB_SD_EN4stub4callEPvSC_SB_+116)
  native: #13 pc 0000000000282060  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (utils::JobSystem::execute(utils::JobSystem::ThreadState&)+976)
  native: #14 pc 0000000000282dd8  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (utils::JobSystem::waitAndRelease(utils::JobSystem::Job*&)+344)
  native: #15 pc 00000000001a5bf8  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (filament::details::FRenderer::endFrame()+456)
  native: #16 pc 00000000001a6148  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (filament::Renderer::endFrame()+24)
  native: #17 pc 000000000013269c  /data/app/com.google.android.filament.ibl-ximffF6qsXCyb1t0QPUvHA==/lib/arm64/libfilament-jni.so (Java_com_google_android_filament_Renderer_nEndFrame+36)
  native: #18 pc 000000000000c4e8  /dev/ashmem/dalvik-jit-code-cache (deleted) (com.google.android.filament.Renderer.nEndFrame+152)
  native: #19 pc 0000000000006fd0  /dev/ashmem/dalvik-jit-code-cache (deleted) (com.google.android.filament.Renderer.endFrame+64)
  native: #20 pc 0000000000007368  /dev/ashmem/dalvik-jit-code-cache (deleted) (com.google.android.filament.ibl.MainActivity$FrameCallback.doFrame+376)
  native: #21 pc 0000000000005418  /dev/ashmem/dalvik-jit-code-cache (deleted) (android.view.Choreographer$CallbackRecord.run+152)
  native: #22 pc 000000000000381c  /dev/ashmem/dalvik-jit-code-cache (deleted) (android.view.Choreographer.doCallbacks+524)
  native: #23 pc 0000000000003fc0  /dev/ashmem/dalvik-jit-code-cache (deleted) (android.view.Choreographer.doFrame+960)
  native: #24 pc 00000000000078b0  /dev/ashmem/dalvik-jit-code-cache (deleted) (android.view.Choreographer$FrameDisplayEventReceiver.run+80)
  native: #25 pc 0000000000009b80  /dev/ashmem/dalvik-jit-code-cache (deleted) (android.os.Handler.handleCallback+64)
  native: #26 pc 000000000000b3bc  /dev/ashmem/dalvik-jit-code-cache (deleted) (android.os.Handler.dispatchMessage+60)
  native: #27 pc 000000000055c988  /system/lib64/libart.so (art_quick_invoke_stub+584)
  native: #28 pc 00000000000cf740  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
  native: #29 pc 00000000002823b0  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
  native: #30 pc 000000000027c36c  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+948)
  native: #31 pc 000000000052c3d8  /system/lib64/libart.so (MterpInvokeVirtual+584)
  native: #32 pc 000000000054f094  /system/lib64/libart.so (ExecuteMterpImpl+14228)
  native: #33 pc 0000000000aebd40  /system/framework/boot-framework.vdex (android.os.Looper.loop+404)
  native: #34 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2495989291+496)
  native: #35 pc 000000000025b9e8  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
  native: #36 pc 000000000027c350  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
  native: #37 pc 000000000052d8dc  /system/lib64/libart.so (MterpInvokeStatic+204)
  native: #38 pc 000000000054f214  /system/lib64/libart.so (ExecuteMterpImpl+14612)
  native: #39 pc 0000000000385452  /system/framework/boot-framework.vdex (android.app.ActivityThread.main+214)
  native: #40 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2495989291+496)
  native: #41 pc 000000000051cb18  /system/lib64/libart.so (artQuickToInterpreterBridge+1032)
  native: #42 pc 0000000000565afc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
  native: #43 pc 000000000055cc4c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
  native: #44 pc 00000000000cf760  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
  native: #45 pc 00000000004633b8  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
  native: #46 pc 0000000000464e10  /system/lib64/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1440)
  native: #47 pc 00000000003f43b0  /system/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+48)
  at com.google.android.filament.Renderer.nEndFrame(Native method)
  at com.google.android.filament.Renderer.endFrame(Renderer.java:49)

pixelflinger added a commit that referenced this issue Jan 29, 2019
This reverts a JobSystem optimization that attempted to avoid signaling
a condition when there was no waiters. Unfortunately, there was a
race that caused the the signaling thread to miss that the waiter flag
was set, thus not signaling.
AdrianAtGoogle pushed a commit to AdrianAtGoogle/filament that referenced this issue Jan 30, 2019
This reverts a JobSystem optimization that attempted to avoid signaling
a condition when there was no waiters. Unfortunately, there was a
race that caused the the signaling thread to miss that the waiter flag
was set, thus not signaling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Issue/feature request for Android only bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants